public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] gdm7240: Add check for NULL for callback in r
@ 2022-11-23 13:23 Ekaterina Esina
  2022-11-26  9:44 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Ekaterina Esina @ 2022-11-23 13:23 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Ekaterina Esina, Won Kang, linux-staging, linux-kernel,
	lvc-project

Before dereferencing r->callback check it for NULL.

Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 61e121047645 ("staging: gdm7240: adding LTE USB driver")
Signed-off-by: Ekaterina Esina <eesina@astralinux.ru>
---
 drivers/staging/gdm724x/gdm_usb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/gdm724x/gdm_usb.c b/drivers/staging/gdm724x/gdm_usb.c
index 54bdb64f52e8..7cf89f4c95c4 100644
--- a/drivers/staging/gdm724x/gdm_usb.c
+++ b/drivers/staging/gdm724x/gdm_usb.c
@@ -409,10 +409,12 @@ static void do_rx(struct work_struct *work)
 		switch (cmd_evt) {
 		case LTE_GET_INFORMATION_RESULT:
 			if (set_mac_address(hci->data, r->cb_data) == 0) {
-				r->callback(r->cb_data,
+				if (r->callback) {
+					r->callback(r->cb_data,
 					    r->buf,
 					    r->urb->actual_length,
 					    KERNEL_THREAD);
+				}
 			}
 			break;
 
-- 
2.30.2


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

end of thread, other threads:[~2022-11-26  9:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-23 13:23 [PATCH] gdm7240: Add check for NULL for callback in r Ekaterina Esina
2022-11-26  9:44 ` Dan Carpenter

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