On Thu, Jun 17, 2021 at 02:46:53PM +0800, Baokun Li wrote: > convert list_for_each() to list_for_each_entry() where > applicable. > > Reported-by: Hulk Robot <hulkci@xxxxxxxxxx> > Signed-off-by: Baokun Li <libaokun1@xxxxxxxxxx> > --- > 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. > return chann; > } regards, dan carpenter