From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: piaojun <piaojun@huawei.com>
Cc: virtio-fs@redhat.com
Subject: Re: [Virtio-fs] [PATCH] virtiofsd: move assert just after calloc()
Date: Wed, 14 Aug 2019 18:14:43 +0100 [thread overview]
Message-ID: <20190814171443.GR2920@work-vm> (raw)
In-Reply-To: <5D478C13.3020406@huawei.com>
* piaojun (piaojun@huawei.com) wrote:
> It's better to assert NULL pointer just after calloc().
>
> Signed-off-by: Jun Piao <piaojun@huawei.com>
Thanks, squashed into 'virtiofsd: Start queue threads'
Dave
> ---
> contrib/virtiofsd/fuse_virtio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/contrib/virtiofsd/fuse_virtio.c b/contrib/virtiofsd/fuse_virtio.c
> index d543c6d..8a4f627 100644
> --- a/contrib/virtiofsd/fuse_virtio.c
> +++ b/contrib/virtiofsd/fuse_virtio.c
> @@ -748,9 +748,9 @@ static void fv_queue_set_started(VuDev *dev, int qidx, bool started)
> }
> if (!vud->qi[qidx]) {
> vud->qi[qidx] = calloc(sizeof(struct fv_QueueInfo), 1);
> + assert(vud->qi[qidx]);
> vud->qi[qidx]->virtio_dev = vud;
> vud->qi[qidx]->qidx = qidx;
> - assert(vud->qi[qidx]);
> } else {
> /* Shouldn't have been started */
> assert(vud->qi[qidx]->kick_fd == -1);
> --
>
> _______________________________________________
> 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
prev parent reply other threads:[~2019-08-14 17:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-05 1:53 [Virtio-fs] [PATCH] virtiofsd: move assert just after calloc() piaojun
2019-08-14 17:14 ` Dr. David Alan Gilbert [this message]
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=20190814171443.GR2920@work-vm \
--to=dgilbert@redhat.com \
--cc=piaojun@huawei.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.