[bug report] net: wwan: iosm: firmware flashing and coredump collection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello M Chetan Kumar,

The patch 13bb8429ca98: "net: wwan: iosm: firmware flashing and
coredump collection" from Sep 13, 2021, leads to the following
Smatch static checker warning:

	drivers/net/wwan/iosm/iosm_ipc_devlink.c:145 ipc_devlink_flash_update()
	warn: potential NULL parameter dereference 'params->component'

drivers/net/wwan/iosm/iosm_ipc_devlink.c
    131 static int ipc_devlink_flash_update(struct devlink *devlink,
    132                                     struct devlink_flash_update_params *params,
    133                                     struct netlink_ext_ack *extack)
    134 {
    135         struct iosm_devlink *ipc_devlink = devlink_priv(devlink);
    136         enum iosm_flash_comp_type fls_type;
    137         u32 rc = -EINVAL;
    138         u8 *mdm_rsp;
    139 
    140         mdm_rsp = kzalloc(IOSM_EBL_DW_PACK_SIZE, GFP_KERNEL);
    141         if (!mdm_rsp)
    142                 return -ENOMEM;
    143 
    144         fls_type = ipc_devlink_get_flash_comp_type(params->component,
--> 145                                                    strlen(params->component));

This function is called from devlink_nl_cmd_flash_update() and
params->component can be NULL so the strlen() will Oops.  Also it's
called from devlink_compat_flash_update() where params->component is
definitely NULL.

    146 
    147         switch (fls_type) {
    148         case FLASH_COMP_TYPE_PSI:
    149                 rc = ipc_flash_boot_psi(ipc_devlink, params->fw);
    150                 break;
    151         case FLASH_COMP_TYPE_EBL:
    152                 rc = ipc_flash_boot_ebl(ipc_devlink, params->fw);
    153                 if (!rc)
    154                         rc = ipc_flash_boot_set_capabilities(ipc_devlink,
    155                                                              mdm_rsp);
    156                 if (!rc)
    157                         rc = ipc_flash_read_swid(ipc_devlink, mdm_rsp);
    158                 break;
    159         case FLASH_COMP_TYPE_FLS:
    160                 rc = ipc_flash_send_fls(ipc_devlink, params->fw, mdm_rsp);
    161                 break;
    162         default:
    163                 devlink_flash_update_status_notify(devlink, "Invalid component",
    164                                                    params->component, 0, 0);
    165                 break;
    166         }
    167 
    168         if (!rc)
    169                 devlink_flash_update_status_notify(devlink, "Flashing success",
    170                                                    params->component, 0, 0);
    171         else
    172                 devlink_flash_update_status_notify(devlink, "Flashing failed",
    173                                                    params->component, 0, 0);
    174 
    175         kfree(mdm_rsp);
    176         return rc;
    177 }

regards,
dan carpenter



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux