* [bug report] platform/x86/intel: Intel TPMI enumeration driver
@ 2023-02-27 7:14 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2023-02-27 7:14 UTC (permalink / raw)
To: srinivas.pandruvada; +Cc: platform-driver-x86
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-27 7:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-27 7:14 [bug report] platform/x86/intel: Intel TPMI enumeration driver Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox