qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Haotian Li <lihaotian9@huawei.com>
To: <qemu-devel@nongnu.org>, <virtio-fs@redhat.com>
Cc: linfeilong@huawei.com, liuzhiqiang26@huawei.com
Subject: [PATCH 1/2] tools/virtiofsd/buffer.c: check whether buf is NULL in fuse_bufvec_advance func
Date: Tue, 10 Nov 2020 09:10:23 +0800	[thread overview]
Message-ID: <743d931f-8d19-3368-9170-084f0f11b28e@huawei.com> (raw)
In-Reply-To: <eeb2fd1d-a53d-eae6-4727-7f1a6b20ac9e@huawei.com>

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 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/virtiofsd/buffer.c b/tools/virtiofsd/buffer.c
index 27c1377f22..c94993b936 100644
--- a/tools/virtiofsd/buffer.c
+++ b/tools/virtiofsd/buffer.c
@@ -246,6 +246,9 @@ 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;
+
     bufv->off += len;
     assert(bufv->off <= buf->size);
     if (bufv->off == buf->size) {
-- 


  reply	other threads:[~2020-11-10  1:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10  1:09 [PATCH 0/2] virtiofsd: fix some accessing NULL pointer problem Haotian Li
2020-11-10  1:10 ` Haotian Li [this message]
2020-11-10  1:11 ` [PATCH 2/2] virtiofsd: check whether lo_map_reserve returns NULL in main func Haotian Li
2020-11-10  1:18 ` [PATCH 0/2] virtiofsd: fix some accessing NULL pointer problem no-reply
2020-11-10  6:01   ` Haotian Li
  -- strict thread matches above, loose matches on Subject: below --
2020-11-10  6:32 [PATCH v2 " Haotian Li
2020-11-10  6:35 ` [PATCH 1/2] tools/virtiofsd/buffer.c: check whether buf is NULL in fuse_bufvec_advance func Haotian Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=743d931f-8d19-3368-9170-084f0f11b28e@huawei.com \
    --to=lihaotian9@huawei.com \
    --cc=linfeilong@huawei.com \
    --cc=liuzhiqiang26@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=virtio-fs@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).