All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harshvardhan Jha <harshvardhan.jha@oracle.com>
To: ericvh@gmail.com
Cc: lucho@ionkov.net, asmadeus@codewreck.org, davem@davemloft.net,
	kuba@kernel.org, v9fs-developer@lists.sourceforge.net,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Harshvardhan Jha <harshvardhan.jha@oracle.com>
Subject: [PATCH] 9p/xen: Fix end of loop tests for list_for_each_entry
Date: Sun, 25 Jul 2021 23:21:03 +0530	[thread overview]
Message-ID: <20210725175103.56731-1-harshvardhan.jha@oracle.com> (raw)

The list_for_each_entry() iterator, "priv" in this code, can never be
NULL so the warning would never be printed.

Signed-off-by: Harshvardhan Jha <harshvardhan.jha@oracle.com>
---
From static analysis.  Not tested.
---
 net/9p/trans_xen.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c
index f4fea28e05da..3ec1a51a6944 100644
--- a/net/9p/trans_xen.c
+++ b/net/9p/trans_xen.c
@@ -138,7 +138,7 @@ static bool p9_xen_write_todo(struct xen_9pfs_dataring *ring, RING_IDX size)
 
 static int p9_xen_request(struct p9_client *client, struct p9_req_t *p9_req)
 {
-	struct xen_9pfs_front_priv *priv = NULL;
+	struct xen_9pfs_front_priv *priv;
 	RING_IDX cons, prod, masked_cons, masked_prod;
 	unsigned long flags;
 	u32 size = p9_req->tc.size;
@@ -151,7 +151,7 @@ static int p9_xen_request(struct p9_client *client, struct p9_req_t *p9_req)
 			break;
 	}
 	read_unlock(&xen_9pfs_lock);
-	if (!priv || priv->client != client)
+	if (list_entry_is_head(priv, &xen_9pfs_devs, list))
 		return -EINVAL;
 
 	num = p9_req->tc.tag % priv->num_rings;
-- 
2.32.0


             reply	other threads:[~2021-07-25 17:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-25 17:51 Harshvardhan Jha [this message]
2021-07-25 20:46 ` [PATCH] 9p/xen: Fix end of loop tests for list_for_each_entry asmadeus
2021-07-26 21:30   ` Stefano Stabellini
2021-07-26 22:23     ` [External] : " Harshvardhan Jha
2021-07-26 23:54       ` Stefano Stabellini
2021-07-26 23:59         ` asmadeus
2021-07-27  0:01           ` Harshvardhan Jha
2021-07-27  0:07         ` Harshvardhan Jha
2021-07-27 14:07           ` asmadeus

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=20210725175103.56731-1-harshvardhan.jha@oracle.com \
    --to=harshvardhan.jha@oracle.com \
    --cc=asmadeus@codewreck.org \
    --cc=davem@davemloft.net \
    --cc=ericvh@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucho@ionkov.net \
    --cc=netdev@vger.kernel.org \
    --cc=v9fs-developer@lists.sourceforge.net \
    /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.