From: Dan Carpenter <dan.carpenter@oracle.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>,
cgroups@vger.kernel.org, linux-mm@kvack.org,
kernel-janitors@vger.kernel.org
Subject: [patch] mm: memcontrol: uninitialized "ret" variables
Date: Thu, 22 Jan 2015 16:30:44 +0300 [thread overview]
Message-ID: <20150122133044.GA23668@mwanda> (raw)
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>
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>,
cgroups@vger.kernel.org, linux-mm@kvack.org,
kernel-janitors@vger.kernel.org
Subject: [patch] mm: memcontrol: uninitialized "ret" variables
Date: Thu, 22 Jan 2015 13:30:44 +0000 [thread overview]
Message-ID: <20150122133044.GA23668@mwanda> (raw)
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;
next reply other threads:[~2015-01-22 13:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-22 13:30 Dan Carpenter [this message]
2015-01-22 13:30 ` [patch] mm: memcontrol: uninitialized "ret" variables Dan Carpenter
2015-01-22 15:25 ` Johannes Weiner
2015-01-22 15:25 ` Johannes Weiner
2015-01-22 15:25 ` Johannes Weiner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150122133044.GA23668@mwanda \
--to=dan.carpenter@oracle.com \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.