* [PATCH RESEND] staging: vme_user: reorder NULL check after kzalloc in fake_crcsr_init
@ 2026-07-23 16:18 Artem Lytkin
0 siblings, 0 replies; only message in thread
From: Artem Lytkin @ 2026-07-23 16:18 UTC (permalink / raw)
To: linux-staging; +Cc: gregkh
Move the NULL check for bridge->crcsr_kernel before its use in
fake_ptr_to_pci(). While fake_ptr_to_pci() is a simple cast that
handles NULL safely, using a value before validating it is a bad
pattern that static analyzers flag and could become a real issue
if fake_ptr_to_pci() changes in the future.
Signed-off-by: Artem Lytkin <iprintercanon@gmail.com>
---
drivers/staging/vme_user/vme_fake.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/vme_user/vme_fake.c b/drivers/staging/vme_user/vme_fake.c
index 434cf760ade6c..5a4e61d204796 100644
--- a/drivers/staging/vme_user/vme_fake.c
+++ b/drivers/staging/vme_user/vme_fake.c
@@ -1029,9 +1029,9 @@ static int fake_crcsr_init(struct vme_bridge *fake_bridge)
/* Allocate mem for CR/CSR image */
bridge->crcsr_kernel = kzalloc(VME_CRCSR_BUF_SIZE, GFP_KERNEL);
- bridge->crcsr_bus = fake_ptr_to_pci(bridge->crcsr_kernel);
if (!bridge->crcsr_kernel)
return -ENOMEM;
+ bridge->crcsr_bus = fake_ptr_to_pci(bridge->crcsr_kernel);
vstat = fake_slot_get(fake_bridge);
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-23 16:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-23 16:18 [PATCH RESEND] staging: vme_user: reorder NULL check after kzalloc in fake_crcsr_init Artem Lytkin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.