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: v9fs@lists.linux.dev, linux-kernel@vger.kernel.org,
	 netdev@vger.kernel.org,
	Dominique Martinet <asmadeus@codewreck.org>
Subject: [PATCH 4/5] 9p: virtio: skip incrementing unused variable
Date: Thu, 27 Apr 2023 20:23:37 +0900	[thread overview]
Message-ID: <20230427-scan-build-v1-4-efa05d65e2da@codewreck.org> (raw)
In-Reply-To: <20230427-scan-build-v1-0-efa05d65e2da@codewreck.org>

Fix the following scan-build warning:
net/9p/trans_virtio.c:504:3: warning: Value stored to 'in' is never read [deadcode.DeadStores]
                in += pack_sg_list_p(chan->sg, out + in, VIRTQUEUE_NUM,
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I'm honestly not 100% sure about this one; I'm tempted to think we
could (should?) just check the return value of pack_sg_list_p to skip
the in_sgs++ and setting sgs[] if it didn't process anything, but I'm
not sure it should ever happen so this is probably fine as is.

Just removing the assignment at least makes it clear the return value
isn't used, so it's an improvement in terms of readability.

Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
---
 net/9p/trans_virtio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index f3f678289423..e305071eb7b8 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -501,8 +501,8 @@ p9_virtio_zc_request(struct p9_client *client, struct p9_req_t *req,
 
 	if (in_pages) {
 		sgs[out_sgs + in_sgs++] = chan->sg + out + in;
-		in += pack_sg_list_p(chan->sg, out + in, VIRTQUEUE_NUM,
-				     in_pages, in_nr_pages, offs, inlen);
+		pack_sg_list_p(chan->sg, out + in, VIRTQUEUE_NUM,
+			       in_pages, in_nr_pages, offs, inlen);
 	}
 
 	BUG_ON(out_sgs + in_sgs > ARRAY_SIZE(sgs));

-- 
2.39.2


  parent reply	other threads:[~2023-04-27 11:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-27 11:23 [PATCH 0/5] Fix scan-build warnings Dominique Martinet
2023-04-27 11:23 ` [PATCH 1/5] 9p: fix ignored return value in v9fs_dir_release Dominique Martinet
2023-05-02 14:46   ` Simon Horman
2023-05-02 23:32     ` Dominique Martinet
2023-05-03  7:17       ` Simon Horman
2023-04-27 11:23 ` [PATCH 2/5] 9p: virtio: fix unlikely null pointer deref in handle_rerror Dominique Martinet
2023-05-02 15:28   ` Simon Horman
2023-04-27 11:23 ` [PATCH 3/5] 9p: virtio: make sure 'offs' is initialized in zc_request Dominique Martinet
2023-05-02 15:27   ` Simon Horman
2023-04-27 11:23 ` Dominique Martinet [this message]
2023-05-02 15:27   ` [PATCH 4/5] 9p: virtio: skip incrementing unused variable Simon Horman
2023-04-27 11:23 ` [PATCH 5/5] 9p: remove dead stores (variable set again without being read) Dominique Martinet
2023-05-02 15:26   ` Simon Horman

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-v1-4-efa05d65e2da@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=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).