Thread (6 messages) read the whole thread 6 messages, 2 authors, 2021-06-18

Re: [PATCH -next] cifsd: fix WARNING: convert list_for_each to entry variant in smb2pdu.c

From: libaokun (A) <hidden>
Date: 2021-06-18 01:44:42
Also in: linux-cifs

I don't know what the difference is between

list_for_each_entry() and list_for_each() for 'struct channel *chann',

but I don't think there's any difference here.

Would you give me more detial about this, please?

Thank you.

Best Regards.


在 2021/6/17 17:26, Dan Carpenter 写道:
On Thu, Jun 17, 2021 at 02:46:53PM +0800, Baokun Li wrote:
quoted
convert list_for_each() to list_for_each_entry() where
applicable.

Reported-by: Hulk Robot <redacted>
Signed-off-by: Baokun Li <redacted>
---
  fs/cifsd/smb2pdu.c | 15 ++++-----------
  1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/fs/cifsd/smb2pdu.c b/fs/cifsd/smb2pdu.c
index ac15a9287310..22ef1d9eed1b 100644
--- a/fs/cifsd/smb2pdu.c
+++ b/fs/cifsd/smb2pdu.c
@@ -74,10 +74,7 @@ static inline int check_session_id(struct ksmbd_conn *conn, u64 id)
  struct channel *lookup_chann_list(struct ksmbd_session *sess)
  {
  	struct channel *chann;
-	struct list_head *t;
-
-	list_for_each(t, &sess->ksmbd_chann_list) {
-		chann = list_entry(t, struct channel, chann_list);
+	list_for_each_entry(chann, &sess->ksmbd_chann_list, chann_list) {
  		if (chann && chann->conn == sess->conn)
"chan" is the list iterator and it can't be NULL.
quoted
  			return chann;
  	}
regards,
dan carpenter

.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help