From: Dan Carpenter <dan.carpenter@oracle.com>
To: cgel.zte@gmail.com
Cc: Larry.Finger@lwfinger.net, phil@philpotter.co.uk,
paskripkin@gmail.com, gregkh@linuxfoundation.org,
straube.linux@gmail.com, martin@kaiser.cx, jhpark1013@gmail.com,
makvihas@gmail.com, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org,
Minghao Chi <chi.minghao@zte.com.cn>,
Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH] staging: r8188eu: remove unnecessary null check
Date: Thu, 25 Aug 2022 09:36:02 +0300 [thread overview]
Message-ID: <20220825063602.GA2071@kadam> (raw)
In-Reply-To: <20220824080350.221614-1-chi.minghao@zte.com.cn>
On Wed, Aug 24, 2022 at 08:03:50AM +0000, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
>
> container_of is never null, so this null check is
> unnecessary.
>
I can't Ack a patch with this commit message because container_of()
*CAN* be NULL. Here, it requires two things:
1) That ->list is the first struct member of struct wlan_network which
is true.
2) That "pmlmepriv->pscanned" is NULL. Which I have not looked at.
It's really ugly to check container_of() for NULL but some people do it
deliberately. Some people also will add a build time assert to ensure
that ->list is always the first element so that the check always works.
regards,
dan carpenter
next prev parent reply other threads:[~2022-08-25 6:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-24 8:03 [PATCH] staging: r8188eu: remove unnecessary null check cgel.zte
2022-08-25 6:36 ` Dan Carpenter [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-11-22 19:53 [PATCH] staging: r8188eu: remove unnecessary NULL check Vihas Mak
2021-11-22 21:22 ` Pavel Skripkin
2021-11-23 23:49 ` Vihas Mak
2021-11-23 8:06 ` Dan Carpenter
2021-11-24 10:00 ` Greg KH
2021-11-25 1:32 ` Vihas Mak
2021-11-25 7:09 ` 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=20220825063602.GA2071@kadam \
--to=dan.carpenter@oracle.com \
--cc=Larry.Finger@lwfinger.net \
--cc=cgel.zte@gmail.com \
--cc=chi.minghao@zte.com.cn \
--cc=gregkh@linuxfoundation.org \
--cc=jhpark1013@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=makvihas@gmail.com \
--cc=martin@kaiser.cx \
--cc=paskripkin@gmail.com \
--cc=phil@philpotter.co.uk \
--cc=straube.linux@gmail.com \
--cc=zealci@zte.com.cn \
/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;
as well as URLs for NNTP newsgroup(s).