[PATCH] firmware: arm_scmi: Fix late checks on pointer dereference

Dan Carpenter dan.carpenter at oracle.com
Tue May 3 23:44:36 PDT 2022


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.

If there is no chance these can be NULL then a different option is to
just delete the NULL checks.

regards,
dan carpenter




More information about the linux-arm-kernel mailing list