public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging:gpib: Fix a dereference before null check issue
@ 2024-11-20 14:46 Paolo Perego
  2024-11-20 16:42 ` [PATCH] staging: gpib: " Markus Elfring
  2024-11-20 17:04 ` [PATCH] staging:gpib: " Dan Carpenter
  0 siblings, 2 replies; 7+ messages in thread
From: Paolo Perego @ 2024-11-20 14:46 UTC (permalink / raw)
  To: linux-staging, linux-kernel
  Cc: Dave Penkler, Greg Kroah-Hartman, Dan Carpenter, Kees Bakker,
	Paolo Perego, Arnd Bergmann

This commit fixes a dereference before null check issue discovered by
Coverity (CID 1601566).

The check ad line 1450 suggests that a_priv can be NULL, however it has
been derefenced before, in the interface_to_usbdev() call.

Signed-off-by: Paolo Perego <pperego@suse.de>
---
 drivers/staging/gpib/agilent_82357a/agilent_82357a.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c
index bf05fb4a736b..604e13c32dfb 100644
--- a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c
+++ b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c
@@ -1446,8 +1446,8 @@ static void agilent_82357a_detach(gpib_board_t *board)
 	mutex_lock(&agilent_82357a_hotplug_lock);
 
 	a_priv = board->private_data;
-	usb_dev = interface_to_usbdev(a_priv->bus_interface);
 	if (a_priv) {
+		usb_dev = interface_to_usbdev(a_priv->bus_interface);
 		if (a_priv->bus_interface) {
 			agilent_82357a_go_idle(board);
 			usb_set_intfdata(a_priv->bus_interface, NULL);
-- 
2.47.0


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

end of thread, other threads:[~2024-11-21 14:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-20 14:46 [PATCH] staging:gpib: Fix a dereference before null check issue Paolo Perego
2024-11-20 16:42 ` [PATCH] staging: gpib: " Markus Elfring
2024-11-20 17:04 ` [PATCH] staging:gpib: " Dan Carpenter
2024-11-20 19:54   ` Kees Bakker
2024-11-21  7:37     ` Dan Carpenter
2024-11-21 14:10       ` Paolo Perego
2024-11-21 14:17         ` Dan Carpenter

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