* [patch] mm: memcontrol: uninitialized "ret" variables
@ 2015-01-22 13:30 Dan Carpenter
2015-01-22 15:25 ` Johannes Weiner
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-01-22 13:30 UTC (permalink / raw)
To: Johannes Weiner; +Cc: Michal Hocko, cgroups, linux-mm, kernel-janitors
We recently re-arranged the code in these functions and now static
checkers complain that "ret" is uninitialized. Oddly enough GCC is fine
with this code.
Fixes: d1ebc463cf89 ('mm: page_counter: pull "-1" handling out of page_counter_memparse()')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 323a01f..7af7834 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3422,7 +3422,7 @@ static ssize_t mem_cgroup_write(struct kernfs_open_file *of,
{
struct mem_cgroup *memcg = mem_cgroup_from_css(of_css(of));
unsigned long nr_pages;
- int ret;
+ int ret = 0;
buf = strstrip(buf);
if (!strcmp(buf, "-1")) {
@@ -3799,7 +3799,8 @@ static int __mem_cgroup_usage_register_event(struct mem_cgroup *memcg,
struct mem_cgroup_threshold_ary *new;
unsigned long threshold;
unsigned long usage;
- int i, size, ret;
+ int i, size;
+ int ret = 0;
if (!strcmp(args, "-1")) {
threshold = PAGE_COUNTER_MAX;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [patch] mm: memcontrol: uninitialized "ret" variables
2015-01-22 13:30 [patch] mm: memcontrol: uninitialized "ret" variables Dan Carpenter
@ 2015-01-22 15:25 ` Johannes Weiner
0 siblings, 0 replies; 2+ messages in thread
From: Johannes Weiner @ 2015-01-22 15:25 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Michal Hocko, cgroups, linux-mm, kernel-janitors
Hi Dan,
On Thu, Jan 22, 2015 at 04:30:44PM +0300, Dan Carpenter wrote:
> We recently re-arranged the code in these functions and now static
> checkers complain that "ret" is uninitialized. Oddly enough GCC is fine
> with this code.
>
> Fixes: d1ebc463cf89 ('mm: page_counter: pull "-1" handling out of page_counter_memparse()')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
This code was again re-arranged in -mm, and that
ret = page_counter_memparse()
is now happening unconditionally, so I think it should be fine. The
latest mmots snapshot (mmots-2015-01-21-16-38) has it.
Thanks!
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-22 15:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-22 13:30 [patch] mm: memcontrol: uninitialized "ret" variables Dan Carpenter
2015-01-22 15:25 ` Johannes Weiner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox