The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] staging: greybus: fix coccinelle false positive on potential NULL dereference
@ 2026-07-28  8:44 Pei Xiao
  2026-07-31 11:20 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Pei Xiao @ 2026-07-28  8:44 UTC (permalink / raw)
  To: vireshk, johan, elder, gregkh, greybus-dev, linux-kernel; +Cc: Pei Xiao

In gb_bootrom_get_firmware(), when fw is NULL, ret is already set to
ERRNO before jumping to the queue_work label, so !ret is always
false and fw->size is never dereferenced. Add an explicit NULL check
to silence a coccinelle false positive warning.

Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
---
 drivers/staging/greybus/bootrom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/bootrom.c b/drivers/staging/greybus/bootrom.c
index 83921d90c322..50c80475d241 100644
--- a/drivers/staging/greybus/bootrom.c
+++ b/drivers/staging/greybus/bootrom.c
@@ -298,7 +298,7 @@ static int gb_bootrom_get_firmware(struct gb_operation *op)
 
 queue_work:
 	/* Refresh timeout */
-	if (!ret && (offset + size == fw->size))
+	if (!ret && fw && (offset + size == fw->size))
 		next_request = NEXT_REQ_READY_TO_BOOT;
 	else
 		next_request = NEXT_REQ_GET_FIRMWARE;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging: greybus: fix coccinelle false positive on potential NULL dereference
  2026-07-28  8:44 [PATCH] staging: greybus: fix coccinelle false positive on potential NULL dereference Pei Xiao
@ 2026-07-31 11:20 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2026-07-31 11:20 UTC (permalink / raw)
  To: Pei Xiao; +Cc: vireshk, johan, elder, greybus-dev, linux-kernel

On Tue, Jul 28, 2026 at 04:44:52PM +0800, Pei Xiao wrote:
> In gb_bootrom_get_firmware(), when fw is NULL, ret is already set to
> ERRNO before jumping to the queue_work label, so !ret is always
> false and fw->size is never dereferenced. Add an explicit NULL check
> to silence a coccinelle false positive warning.

Why not fix the coccinelle tool/script instead?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-31 11:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-28  8:44 [PATCH] staging: greybus: fix coccinelle false positive on potential NULL dereference Pei Xiao
2026-07-31 11:20 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox