[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Virtio-fs] [PATCH 1/3] tools/virtiofsd/buffer.c: check whether buf
From: |
Dr. David Alan Gilbert |
Subject: |
Re: [Virtio-fs] [PATCH 1/3] tools/virtiofsd/buffer.c: check whether buf is NULL in fuse_bufvec_advance func |
Date: |
Wed, 11 Nov 2020 19:59:01 +0000 |
User-agent: |
Mutt/1.14.6 (2020-07-11) |
* Haotian Li (lihaotian9@huawei.com) wrote:
> In fuse_bufvec_advance func, calling fuse_bufvec_current func
> may return NULL, so we should check whether buf is NULL before
> using it.
>
> Signed-off-by: Haotian Li <lihaotian9@huawei.com>
> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
> ---
> tools/virtiofsd/buffer.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/virtiofsd/buffer.c b/tools/virtiofsd/buffer.c
> index 27c1377f22..bdc608c221 100644
> --- a/tools/virtiofsd/buffer.c
> +++ b/tools/virtiofsd/buffer.c
> @@ -246,6 +246,10 @@ static int fuse_bufvec_advance(struct fuse_bufvec *bufv,
> size_t len)
> {
> const struct fuse_buf *buf = fuse_bufvec_current(bufv);
>
> + if (!buf) {
> + return 0;
> + }
> +
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> bufv->off += len;
> assert(bufv->off <= buf->size);
> if (bufv->off == buf->size) {
> --
>
> _______________________________________________
> 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
- Re: [Virtio-fs] [PATCH 1/3] tools/virtiofsd/buffer.c: check whether buf is NULL in fuse_bufvec_advance func,
Dr. David Alan Gilbert <=
- [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: [PATCH v3 0/3] virtiofsd: fix some accessing NULL pointer problem, Dr. David Alan Gilbert, 2020/11/12