[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220825063602.GA2071@kadam>
Date: Thu, 25 Aug 2022 09:36:02 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: cgel.zte@...il.com
Cc: Larry.Finger@...inger.net, phil@...lpotter.co.uk,
paskripkin@...il.com, gregkh@...uxfoundation.org,
straube.linux@...il.com, martin@...ser.cx, jhpark1013@...il.com,
makvihas@...il.com, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org, Minghao Chi <chi.minghao@....com.cn>,
Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH] staging: r8188eu: remove unnecessary null check
On Wed, Aug 24, 2022 at 08:03:50AM +0000, cgel.zte@...il.com wrote:
> From: Minghao Chi <chi.minghao@....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
Powered by blists - more mailing lists