Skip to contentSkip to conversation

cgroup: convert to kernfs

DISCUSSION Dan Carpenter 2 participants 2 messages Feb 12, 2014 1 message not in the archive cgroup

lore
Share & tools
lore
#0 lore raw

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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hello, Dan.

Quoted 13 lines · Dan Carpenter

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)

Quoted 1 line

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!

Signature · 1 line
tejun