Linux cgroups development
 help / color / mirror / Atom feed
* re: cgroup: convert to kernfs
@ 2014-02-12 19:27 Dan Carpenter
       [not found] ` <20140212192753.GA5217-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2014-02-12 19:27 UTC (permalink / raw)
  To: tj-DgEjT+Ai2ygdnm+yROfE0A; +Cc: cgroups-u79uwXL29TY76Z2rM5mHXA

Hello Tejun Heo,

The patch 2bd59d48ebfb: "cgroup: convert to kernfs" from Feb 11,
2014, leads to the following static checker warning:

	kernel/cgroup.c:2442 cgroup_add_cftypes()
	warn: possible memory leak of 'set'

kernel/cgroup.c
  2431  int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts)
  2432  {
  2433          struct cftype_set *set;
  2434          int ret;
  2435  
  2436          set = kzalloc(sizeof(*set), GFP_KERNEL);
  2437          if (!set)
  2438                  return -ENOMEM;
  2439  
  2440          ret = cgroup_init_cftypes(ss, cfts);
  2441          if (ret)

kfree(set);

  2442                  return ret;
  2443  
  2444          cgroup_cfts_prepare();
  2445          set->cfts = cfts;
  2446          list_add_tail(&set->node, &ss->cftsets);
  2447          ret = cgroup_cfts_commit(cfts, true);
  2448          if (ret)
  2449                  cgroup_rm_cftypes(cfts);
  2450          return ret;
  2451  }

regards,
dan carpenter

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

* Re: cgroup: convert to kernfs
       [not found] ` <20140212192753.GA5217-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
@ 2014-02-12 19:53   ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2014-02-12 19:53 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: cgroups-u79uwXL29TY76Z2rM5mHXA

Hello, Dan.

On Wed, Feb 12, 2014 at 10:27:53PM +0300, Dan Carpenter wrote:
> kernel/cgroup.c
>   2431  int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts)
>   2432  {
>   2433          struct cftype_set *set;
>   2434          int ret;
>   2435  
>   2436          set = kzalloc(sizeof(*set), GFP_KERNEL);
>   2437          if (!set)
>   2438                  return -ENOMEM;
>   2439  
>   2440          ret = cgroup_init_cftypes(ss, cfts);
>   2441          if (ret)
> 
> kfree(set);

Oops, thanks for the report; however, the whole cftype_set handling
gets removed by a later patch which is already committed, so the issue
shouldn't exist anymore.

Thanks!

-- 
tejun

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

end of thread, other threads:[~2014-02-12 19:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-12 19:27 cgroup: convert to kernfs Dan Carpenter
     [not found] ` <20140212192753.GA5217-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
2014-02-12 19:53   ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox