public inbox for linux-cifs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Baokun Li <libaokun1@huawei.com>
Cc: Namjae Jeon <namjae.jeon@samsung.com>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Steve French <sfrench@samba.org>,
	Hyunchul Lee <hyc.lee@gmail.com>,
	linux-cifs@vger.kernel.org,
	linux-cifsd-devel@lists.sourceforge.net,
	kernel-janitors@vger.kernel.org, Hulk Robot <hulkci@huawei.com>
Subject: Re: [PATCH -next] cifsd: fix WARNING: convert list_for_each to entry variant in smb2pdu.c
Date: Thu, 17 Jun 2021 12:26:39 +0300	[thread overview]
Message-ID: <20210617092639.GD1861@kadam> (raw)
In-Reply-To: <20210617064653.3193618-1-libaokun1@huawei.com>

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@huawei.com>
> Signed-off-by: Baokun Li <libaokun1@huawei.com>
> ---
>  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


  reply	other threads:[~2021-06-17  9:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17  6:46 [PATCH -next] cifsd: fix WARNING: convert list_for_each to entry variant in smb2pdu.c Baokun Li
2021-06-17  9:26 ` Dan Carpenter [this message]
2021-06-18  1:44   ` libaokun (A)
2021-06-18  5:14     ` Dan Carpenter
2021-06-18  7:47       ` libaokun (A)
2021-06-18  8:19         ` Dan Carpenter

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=20210617092639.GD1861@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=hulkci@huawei.com \
    --cc=hyc.lee@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=libaokun1@huawei.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-cifsd-devel@lists.sourceforge.net \
    --cc=namjae.jeon@samsung.com \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=sfrench@samba.org \
    /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