Skip to content

Commit 732b33d

Browse files
Harshvardhan Jhamartinetd
authored andcommitted
9p/xen: Fix end of loop tests for list_for_each_entry
This patch addresses the following problems: - priv can never be NULL, so this part of the check is useless - if the loop ran through the whole list, priv->client is invalid and it is more appropriate and sufficient to check for the end of list_for_each_entry loop condition. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Harshvardhan Jha <[email protected]> Reviewed-by: Stefano Stabellini <[email protected]> Tested-by: Stefano Stabellini <[email protected]> Cc: <[email protected]> Signed-off-by: Dominique Martinet <[email protected]>
1 parent f997ea3 commit 732b33d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/9p/trans_xen.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ static bool p9_xen_write_todo(struct xen_9pfs_dataring *ring, RING_IDX size)
138138

139139
static int p9_xen_request(struct p9_client *client, struct p9_req_t *p9_req)
140140
{
141-
struct xen_9pfs_front_priv *priv = NULL;
141+
struct xen_9pfs_front_priv *priv;
142142
RING_IDX cons, prod, masked_cons, masked_prod;
143143
unsigned long flags;
144144
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)
151151
break;
152152
}
153153
read_unlock(&xen_9pfs_lock);
154-
if (!priv || priv->client != client)
154+
if (list_entry_is_head(priv, &xen_9pfs_devs, list))
155155
return -EINVAL;
156156

157157
num = p9_req->tc.tag % priv->num_rings;

0 commit comments

Comments
 (0)