Linux Power Management development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: daniel.lezcano@linaro.org
Cc: linux-pm@vger.kernel.org
Subject: [bug report] thermal/drivers/cpuidle_cooling: Use device name instead of auto-numbering
Date: Thu, 18 Mar 2021 13:20:00 +0300	[thread overview]
Message-ID: <YFMpUDNGIiLOzr0/@mwanda> (raw)

Hello Daniel Lezcano,

The patch 6fd1b186d900: "thermal/drivers/cpuidle_cooling: Use device
name instead of auto-numbering" from Mar 14, 2021, leads to the
following static checker warning:

	drivers/thermal/cpuidle_cooling.c:218 __cpuidle_cooling_register()
	warn: 'name' was already freed.

drivers/thermal/cpuidle_cooling.c
   200  
   201          dev = get_cpu_device(cpumask_first(drv->cpumask));
   202  
   203          name = kasprintf(GFP_KERNEL, "idle-%s", dev_name(dev));
   204          if (!name) {
   205                  ret = -ENOMEM;
   206                  goto out_unregister;
   207          }
   208  
   209          cdev = thermal_of_cooling_device_register(np, name, idle_cdev,
   210                                                    &cpuidle_cooling_ops);
   211          kfree(name);
                ^^^^^^^^^^^^

   212  
   213          if (IS_ERR(cdev)) {
   214                  ret = PTR_ERR(cdev);
   215                  goto out_unregister;
   216          }
   217  
   218          pr_debug("%s: Idle injection set with idle duration=%u, latency=%u\n",
   219                   name, idle_duration_us, latency_us);
                         ^^^^
Used after free

   220  
   221          return 0;
   222  
   223  out_unregister:
   224          idle_inject_unregister(ii_dev);
   225  out_kfree:
   226          kfree(idle_cdev);
   227  out:
   228          return ret;
   229  }

regards,
dan carpenter

             reply	other threads:[~2021-03-18 10:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 10:20 Dan Carpenter [this message]
2021-03-18 10:38 ` [bug report] thermal/drivers/cpuidle_cooling: Use device name instead of auto-numbering Daniel Lezcano
2021-03-19 20:25 ` [PATCH] thermal/drivers/cpuidle_cooling: Fix use after error Daniel Lezcano
2021-03-22  3:29   ` Viresh Kumar
2021-03-22  8:08     ` Daniel Lezcano
2021-03-22  8:12       ` Viresh Kumar
2021-04-15 12:04   ` [thermal: thermal/next] " thermal-bot for Daniel Lezcano

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=YFMpUDNGIiLOzr0/@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-pm@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox