[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YnIjbrP9NjQja+fV@e120937-lin>
Date: Wed, 4 May 2022 07:55:56 +0100
From: Cristian Marussi <cristian.marussi@....com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
sudeep.holla@....com, kernel test robot <lkp@...el.com>
Subject: Re: [PATCH] firmware: arm_scmi: Fix late checks on pointer
dereference
On Wed, May 04, 2022 at 09:44:36AM +0300, Dan Carpenter wrote:
> On Tue, May 03, 2022 at 01:10:47PM +0100, Cristian Marussi wrote:
> > A few dereferences could happen before the iterator pointer argument was
> > checked for NULL, causing the following smatch warnings:
> >
> > drivers/firmware/arm_scmi/driver.c:1214 scmi_iterator_run() warn: variable
> > dereferenced before check 'i' (see line 1210)
> >
> > Fix by moving the checks early and dropping some unneeded local references.
> >
> > No functional change.
>
Hi Dan,
thanks for you feedback first of all.
> If there is no chance these can be NULL then a different option is to
> just delete the NULL checks.
Indeed, I think I kept only the checks on iter param that can possibly
be NULL if the caller messes up the usage of this iterator interface
(or if the internals are messed up by future developments...just to
play on the safe side).
Thanks,
Cristian
Powered by blists - more mailing lists