All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: srinivas.pandruvada@linux.intel.com
Cc: platform-driver-x86@vger.kernel.org
Subject: [bug report] platform/x86/intel: Intel TPMI enumeration driver
Date: Mon, 27 Feb 2023 10:14:15 +0300	[thread overview]
Message-ID: <Y/xYR7WGiPayZu/R@kili> (raw)

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

                 reply	other threads:[~2023-02-27  7:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y/xYR7WGiPayZu/R@kili \
    --to=error27@gmail.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.