diff options
author | Adrian Bunk <bunk@kernel.org> | 2007-11-14 20:00:37 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-14 21:45:44 -0500 |
commit | f96159840bc5f605aca5113ab2d24308d3dc2eff (patch) | |
tree | 91e877d755451415ea79fe9da4419b465a0575d0 /kernel/taskstats.c | |
parent | 4ae44c57748ad37dcd1d998525f6929d2fe39d02 (diff) |
kernel/taskstats.c: fix bogus nlmsg_free()
We'd better not nlmsg_free on a pointer containing an undefined value
(and without having anything allocated).
Spotted by the Coverity checker.
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/taskstats.c')
-rw-r--r-- | kernel/taskstats.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/kernel/taskstats.c b/kernel/taskstats.c index 354e74bc17c1..07e86a828073 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c | |||
@@ -398,31 +398,31 @@ static int cgroupstats_user_cmd(struct sk_buff *skb, struct genl_info *info) | |||
398 | 398 | ||
399 | fd = nla_get_u32(info->attrs[CGROUPSTATS_CMD_ATTR_FD]); | 399 | fd = nla_get_u32(info->attrs[CGROUPSTATS_CMD_ATTR_FD]); |
400 | file = fget_light(fd, &fput_needed); | 400 | file = fget_light(fd, &fput_needed); |
401 | if (file) { | 401 | if (!file) |
402 | size = nla_total_size(sizeof(struct cgroupstats)); | 402 | return 0; |
403 | 403 | ||
404 | rc = prepare_reply(info, CGROUPSTATS_CMD_NEW, &rep_skb, | 404 | size = nla_total_size(sizeof(struct cgroupstats)); |
405 | size); | ||
406 | if (rc < 0) | ||
407 | goto err; | ||
408 | 405 | ||
409 | na = nla_reserve(rep_skb, CGROUPSTATS_TYPE_CGROUP_STATS, | 406 | rc = prepare_reply(info, CGROUPSTATS_CMD_NEW, &rep_skb, |
410 | sizeof(struct cgroupstats)); | 407 | size); |
411 | stats = nla_data(na); | 408 | if (rc < 0) |
412 | memset(stats, 0, sizeof(*stats)); | 409 | goto err; |
413 | 410 | ||
414 | rc = cgroupstats_build(stats, file->f_dentry); | 411 | na = nla_reserve(rep_skb, CGROUPSTATS_TYPE_CGROUP_STATS, |
415 | if (rc < 0) | 412 | sizeof(struct cgroupstats)); |
416 | goto err; | 413 | stats = nla_data(na); |
414 | memset(stats, 0, sizeof(*stats)); | ||
417 | 415 | ||
418 | fput_light(file, fput_needed); | 416 | rc = cgroupstats_build(stats, file->f_dentry); |
419 | return send_reply(rep_skb, info->snd_pid); | 417 | if (rc < 0) { |
418 | nlmsg_free(rep_skb); | ||
419 | goto err; | ||
420 | } | 420 | } |
421 | 421 | ||
422 | rc = send_reply(rep_skb, info->snd_pid); | ||
423 | |||
422 | err: | 424 | err: |
423 | if (file) | 425 | fput_light(file, fput_needed); |
424 | fput_light(file, fput_needed); | ||
425 | nlmsg_free(rep_skb); | ||
426 | return rc; | 426 | return rc; |
427 | } | 427 | } |
428 | 428 | ||