All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] thermal/drivers/cpuidle_cooling: Use device name instead of auto-numbering
@ 2021-03-18 10:20 Dan Carpenter
  2021-03-18 10:38 ` Daniel Lezcano
  2021-03-19 20:25 ` [PATCH] thermal/drivers/cpuidle_cooling: Fix use after error Daniel Lezcano
  0 siblings, 2 replies; 7+ messages in thread
From: Dan Carpenter @ 2021-03-18 10:20 UTC (permalink / raw)
  To: daniel.lezcano; +Cc: linux-pm

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-04-15 12:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18 10:20 [bug report] thermal/drivers/cpuidle_cooling: Use device name instead of auto-numbering Dan Carpenter
2021-03-18 10:38 ` 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

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.