[bug report] platform/x86/intel: Intel TPMI enumeration driver

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

 



Hello Srinivas Pandruvada,

The patch 47731fd2865f: "platform/x86/intel: Intel TPMI enumeration
driver" from Feb 1, 2023, leads to the following Smatch static
checker warning:

	drivers/platform/x86/intel/tpmi.c:253 tpmi_create_device()
	warn: 'feature_vsec_dev' was already freed.

drivers/platform/x86/intel/tpmi.c
    232         feature_vsec_dev->pcidev = vsec_dev->pcidev;
    233         feature_vsec_dev->resource = res;
    234         feature_vsec_dev->num_resources = pfs->pfs_header.num_entries;
    235         feature_vsec_dev->priv_data = &tpmi_info->plat_info;
    236         feature_vsec_dev->priv_data_size = sizeof(tpmi_info->plat_info);
    237         feature_vsec_dev->ida = &intel_vsec_tpmi_ida;
    238 
    239         /*
    240          * intel_vsec_add_aux() is resource managed, no explicit
    241          * delete is required on error or on module unload.
    242          */
    243         ret = intel_vsec_add_aux(vsec_dev->pcidev, &vsec_dev->auxdev.dev,
    244                                  feature_vsec_dev, feature_id_name);
                                         ^^^^^^^^^^^^^^^^
Freed.  Just from a glace the free here seems like the real bug.

    245         if (ret)
    246                 goto free_res;
    247 
    248         return 0;
    249 
    250 free_res:
    251         kfree(res);
    252 free_vsec:
--> 253         kfree(feature_vsec_dev);
                      ^^^^^^^^^^^^^^^^
Double freed.

    254 
    255         return ret;
    256 }

regards,
dan carpenter



[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux