[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Virtio-fs] [PATCH 3/3] virtiofsd: check whether strdup lo.source re
From: |
Dr. David Alan Gilbert |
Subject: |
Re: [Virtio-fs] [PATCH 3/3] virtiofsd: check whether strdup lo.source return NULL in main func |
Date: |
Wed, 11 Nov 2020 19:55:00 +0000 |
User-agent: |
Mutt/1.14.6 (2020-07-11) |
* Haotian Li (lihaotian9@huawei.com) wrote:
> In main func, strdup lo.source may fail. So check whether strdup
> lo.source return NULL before using it.
>
> Signed-off-by: Haotian Li <lihaotian9@huawei.com>
> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
> ---
> tools/virtiofsd/passthrough_ll.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/virtiofsd/passthrough_ll.c
> b/tools/virtiofsd/passthrough_ll.c
> index 3e9bbc7a04..0c11134fb5 100644
> --- a/tools/virtiofsd/passthrough_ll.c
> +++ b/tools/virtiofsd/passthrough_ll.c
> @@ -3525,6 +3525,10 @@ int main(int argc, char *argv[])
> }
> } else {
> lo.source = strdup("/");
> + if (!lo.source) {
> + fuse_log(FUSE_LOG_ERR, "failed to strdup source\n");
> + goto err_out1;
> + }
> }
>
(It's interesting we use exit's in some places, goto's in others)
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> if (lo.xattrmap) {
> --
>
> _______________________________________________
> Virtio-fs mailing list
> Virtio-fs@redhat.com
> https://www.redhat.com/mailman/listinfo/virtio-fs
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
- [PATCH v3 0/3] virtiofsd: fix some accessing NULL pointer problem, Haotian Li, 2020/11/10
- [PATCH 1/3] tools/virtiofsd/buffer.c: check whether buf is NULL in fuse_bufvec_advance func, Haotian Li, 2020/11/10
- [PATCH 2/3] virtiofsd: check whether lo_map_reserve returns NULL in, main func, Haotian Li, 2020/11/10
- [PATCH 3/3] virtiofsd: check whether strdup lo.source return NULL in main func, Haotian Li, 2020/11/10
- Re: [Virtio-fs] [PATCH 3/3] virtiofsd: check whether strdup lo.source return NULL in main func,
Dr. David Alan Gilbert <=
- Re: [PATCH v3 0/3] virtiofsd: fix some accessing NULL pointer problem, Dr. David Alan Gilbert, 2020/11/12