Skip to contentSkip to conversation

iwlwifi: mei: add the driver to allow cooperation with CSME

bug report Dan Carpenter 1 participant 1 message Nov 30, 2021

lore
Share & tools
lore
#0 lore raw

Hello Emmanuel Grumbach,

The patch 2da4366f9e2c: "iwlwifi: mei: add the driver to allow cooperation with CSME" from Nov 12, 2021, leads to the following Smatch static checker warning:

drivers/net/wireless/intel/iwlwifi/mei/main.c:632 iwl_mei_handle_csme_filters()
error: potential null dereference 'new_filters'. (kzalloc returns null)

drivers/net/wireless/intel/iwlwifi/mei/main.c

    618 static void iwl_mei_handle_csme_filters(struct mei_cl_device *cldev,
    619                                         const struct iwl_sap_csme_filters *filters)
    620 {
    621         struct iwl_mei *mei = mei_cldev_get_drvdata(iwl_mei_global_cldev);
    622         struct iwl_mei_filters *new_filters;
    623         struct iwl_mei_filters *old_filters;
    624 
    625         old_filters =
    626                 rcu_dereference_protected(mei->filters,
    627                                           lockdep_is_held(&iwl_mei_mutex));
    628 
    629         new_filters = kzalloc(sizeof(*new_filters), GFP_KERNEL);
                ^^^^^^^^^^^^^^^^^^^^^

No check for NULL on this allocation.

630
631 /* Copy the OOB filters */

--> 632         new_filters->filters = filters->filters;
    633 
    634         rcu_assign_pointer(mei->filters, new_filters);
    635 
    636         if (old_filters)
    637                 kfree_rcu(old_filters, rcu_head);
    638 }

regards,
dan carpenter