答复: [PATCH] staging: greybus: Fix potential NULL dereference

From: 白浩文
Date: Sun Mar 13 2022 - 21:47:48 EST


Thank you for your suggestion.
________________________________________
发件人: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
发送时间: 2022年3月11日 19:32:08
收件人: 白浩文
抄送: vireshk@xxxxxxxxxx; johan@xxxxxxxxxx; elder@xxxxxxxxxx; gregkh@xxxxxxxxxxxxxxxxxxx; linux-staging@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
主题: Re: [PATCH] staging: greybus: Fix potential NULL dereference

On Fri, Mar 11, 2022 at 04:35:30PM +0800, Haowen Bai wrote:
> Fix following coccicheck warning:
> drivers/staging/greybus/bootrom.c:301:35-39: ERROR: fw is NULL but dereferenced.
>
> When goto queue_work but dereference Uninitialized fw will trigger a NULL
> dereference.
>
> Signed-off-by: Haowen Bai <baihaowen@xxxxxxxxx>

Your patch claims to fix a bug, but the warning is a false positive.
When we "goto queue_work;" then "ret = -EINVAL" so that means that we
will not dereference "fw".

You should ignore false positive warnings.

We would apply the patch only if it made the code more readable but I
do not think that is the case here. I do not really even see how the
patch silences the false positive warning, but it may do...

Anyway, the point is: False positive. Ignore it.

regards,
dan carpenter