From: Vivek Goyal <vgoyal@redhat.com>
To: linux-fsdevel@vger.kernel.org, virtio-fs@redhat.com, miklos@szeredi.hu
Cc: vgoyal@redhat.com, dgilbert@redhat.com,
linux-kernel@vger.kernel.org, dan.carpenter@oracle.com
Subject: [PATCH 2/2] virtiofs, dax: Fixed smatch warning about ret being uninitialized
Date: Thu, 6 May 2021 14:43:04 -0400 [thread overview]
Message-ID: <20210506184304.321645-3-vgoyal@redhat.com> (raw)
In-Reply-To: <20210506184304.321645-1-vgoyal@redhat.com>
Dan reported a smatch warning about "ret" being uninitialized. Fix it.
fs/fuse/dax.c:197 dmap_removemapping_list() error: uninitialized symbol 'ret'.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
fs/fuse/dax.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c
index f06fdad3f7b1..1608b6606ef0 100644
--- a/fs/fuse/dax.c
+++ b/fs/fuse/dax.c
@@ -253,7 +253,10 @@ static int dmap_removemapping_list(struct inode *inode, unsigned int num,
struct fuse_removemapping_one *remove_one, *ptr;
struct fuse_removemapping_in inarg;
struct fuse_dax_mapping *dmap;
- int ret, i = 0, nr_alloc;
+ int ret = 0, i = 0, nr_alloc;
+
+ if (!num)
+ return ret;
nr_alloc = min_t(unsigned int, num, FUSE_REMOVEMAPPING_MAX_ENTRY);
remove_one = kmalloc_array(nr_alloc, sizeof(*remove_one), GFP_NOFS);
--
2.25.4
prev parent reply other threads:[~2021-05-06 18:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-06 18:43 [PATCH 0/2] virtiofs, dax: Fix couple of smatch warnings Vivek Goyal
2021-05-06 18:43 ` [PATCH 1/2] virtiofs, dax: Fix smatch warning about loss of info during shift Vivek Goyal
2021-05-06 19:07 ` Dr. David Alan Gilbert
2021-05-06 19:35 ` Matthew Wilcox
2021-05-10 18:16 ` Vivek Goyal
2021-05-06 18:43 ` Vivek Goyal [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=20210506184304.321645-3-vgoyal@redhat.com \
--to=vgoyal@redhat.com \
--cc=dan.carpenter@oracle.com \
--cc=dgilbert@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--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).