usb-host: Add check NULL dereference 91/297691/1
authorYunhee Seo <yuni.seo@samsung.com>
Wed, 23 Aug 2023 02:57:49 +0000 (11:57 +0900)
committerYunhee Seo <yuni.seo@samsung.com>
Wed, 23 Aug 2023 02:57:49 +0000 (11:57 +0900)
Fix static analysis NULL dereference issue.

Change-Id: I9bcf942ae1b8032d399019dec01ed3b15d3d96ca
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
src/usb-host/usb-host.c

index 7dc2936a6703aaab72c63dddd3459b4c441bd825..7ef0a1b07ba6a14883977051aadcee07f4512664 100644 (file)
@@ -337,6 +337,11 @@ static void uevent_usbhost_handler(struct udev_device *dev)
        }
 
        action = udev_device_get_action(dev);
+       if (!action) {
+               _E("Failed to get action from udev_device.");
+               return;
+       }
+
        _I("Subsystem=%s devtype=%s action=%s", subsystem, devtype, action);
        /* Policy is valid for entire device, thus we check this devtype here */
        if (strncmp(subsystem, USB_SUBSYSTEM, sizeof(USB_SUBSYSTEM)) == 0 &&