v9fs.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Dominique Martinet <asmadeus@codewreck.org>
To: Eric Van Hensbergen <ericvh@gmail.com>,
	 Latchesar Ionkov <lucho@ionkov.net>,
	 Christian Schoenebeck <linux_oss@crudebyte.com>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <simon.horman@corigine.com>,
	v9fs@lists.linux.dev,  linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org,
	 Dominique Martinet <asmadeus@codewreck.org>
Subject: [PATCH v2 3/5] 9p: virtio: make sure 'offs' is initialized in zc_request
Date: Wed, 03 May 2023 16:49:27 +0900	[thread overview]
Message-ID: <20230427-scan-build-v2-3-bb96a6e6a33b@codewreck.org> (raw)
In-Reply-To: <20230427-scan-build-v2-0-bb96a6e6a33b@codewreck.org>

Similarly to the previous patch: offs can be used in handle_rerrors
without initializing on small payloads; in this case handle_rerrors will
not use it because of the size check, but it doesn't hurt to make sure
it is zero to please scan-build.

This fixes the following warning:
net/9p/trans_virtio.c:539:3: warning: 3rd function call argument is an uninitialized value [core.CallAndMessage]
                handle_rerror(req, in_hdr_len, offs, in_pages);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
---
 net/9p/trans_virtio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index 2c9495ccda6b..f3f678289423 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -428,7 +428,7 @@ p9_virtio_zc_request(struct p9_client *client, struct p9_req_t *req,
 	struct page **in_pages = NULL, **out_pages = NULL;
 	struct virtio_chan *chan = client->trans;
 	struct scatterlist *sgs[4];
-	size_t offs;
+	size_t offs = 0;
 	int need_drop = 0;
 	int kicked = 0;
 

-- 
2.39.2


  parent reply	other threads:[~2023-05-03  7:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-03  7:49 [PATCH v2 0/5] Fix scan-build warnings Dominique Martinet
2023-05-03  7:49 ` [PATCH v2 1/5] 9p: fix ignored return value in v9fs_dir_release Dominique Martinet
2023-05-03  7:49 ` [PATCH v2 2/5] 9p: virtio: fix unlikely null pointer deref in handle_rerror Dominique Martinet
2023-05-03  7:49 ` Dominique Martinet [this message]
2023-05-03  7:49 ` [PATCH v2 4/5] 9p: virtio: skip incrementing unused variable Dominique Martinet
2023-05-03  7:49 ` [PATCH v2 5/5] 9p: remove dead stores (variable set again without being read) Dominique Martinet
2023-05-03  8:22   ` Christian Schoenebeck
2023-05-03  8:44     ` Dominique Martinet
2023-07-20 21:26 ` [PATCH v2 0/5] Fix scan-build warnings Eric Van Hensbergen

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=20230427-scan-build-v2-3-bb96a6e6a33b@codewreck.org \
    --to=asmadeus@codewreck.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=ericvh@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux_oss@crudebyte.com \
    --cc=lucho@ionkov.net \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=simon.horman@corigine.com \
    --cc=v9fs@lists.linux.dev \
    /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).