* [PATCH] mm: fix: Uninitialized variable ret.
@ 2020-12-30 6:59 YANG LI
2020-12-30 7:10 ` Muchun Song
2021-01-05 11:03 ` David Hildenbrand
0 siblings, 2 replies; 3+ messages in thread
From: YANG LI @ 2020-12-30 6:59 UTC (permalink / raw)
To: hannes
Cc: mhocko, vdavydov.dev, akpm, cgroups, linux-mm, linux-kernel, YANG LI
The ret is being used but it isn't being initialized,
need to assign a value to it, like 0.
Signed-off-by: YANG LI <abaci-bugfix@linux.alibaba.com>
Reported-by: Abaci <abaci@linux.alibaba.com>
---
mm/memcontrol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 605f671..15ba17d 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3366,7 +3366,7 @@ static int mem_cgroup_resize_max(struct mem_cgroup *memcg,
{
bool enlarge = false;
bool drained = false;
- int ret;
+ int ret = 0;
bool limits_invariant;
struct page_counter *counter = memsw ? &memcg->memsw : &memcg->memory;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: fix: Uninitialized variable ret.
2020-12-30 6:59 [PATCH] mm: fix: Uninitialized variable ret YANG LI
@ 2020-12-30 7:10 ` Muchun Song
2021-01-05 11:03 ` David Hildenbrand
1 sibling, 0 replies; 3+ messages in thread
From: Muchun Song @ 2020-12-30 7:10 UTC (permalink / raw)
To: YANG LI
Cc: hannes, mhocko, vdavydov.dev, akpm, cgroups, linux-mm, linux-kernel
YANG LI <abaci-bugfix@linux.alibaba.com> 于2020年12月30日周三 下午3:02写道:
>
> The ret is being used but it isn't being initialized,
> need to assign a value to it, like 0.
Hi Yang,
I didn't see where it was used without initialized.
Can you point that out to me?
Thanks.
>
> Signed-off-by: YANG LI <abaci-bugfix@linux.alibaba.com>
> Reported-by: Abaci <abaci@linux.alibaba.com>
> ---
> mm/memcontrol.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 605f671..15ba17d 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -3366,7 +3366,7 @@ static int mem_cgroup_resize_max(struct mem_cgroup *memcg,
> {
> bool enlarge = false;
> bool drained = false;
> - int ret;
> + int ret = 0;
> bool limits_invariant;
> struct page_counter *counter = memsw ? &memcg->memsw : &memcg->memory;
>
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: fix: Uninitialized variable ret.
2020-12-30 6:59 [PATCH] mm: fix: Uninitialized variable ret YANG LI
2020-12-30 7:10 ` Muchun Song
@ 2021-01-05 11:03 ` David Hildenbrand
1 sibling, 0 replies; 3+ messages in thread
From: David Hildenbrand @ 2021-01-05 11:03 UTC (permalink / raw)
To: YANG LI, hannes
Cc: mhocko, vdavydov.dev, akpm, cgroups, linux-mm, linux-kernel
On 30.12.20 07:59, YANG LI wrote:
> The ret is being used but it isn't being initialized,
> need to assign a value to it, like 0.
>
> Signed-off-by: YANG LI <abaci-bugfix@linux.alibaba.com>
> Reported-by: Abaci <abaci@linux.alibaba.com>
> ---
> mm/memcontrol.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 605f671..15ba17d 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -3366,7 +3366,7 @@ static int mem_cgroup_resize_max(struct mem_cgroup *memcg,
> {
> bool enlarge = false;
> bool drained = false;
> - int ret;
> + int ret = 0;
> bool limits_invariant;
> struct page_counter *counter = memsw ? &memcg->memsw : &memcg->memory;
>
>
Before every "break" in the loop, we have a "ret = ". The loop runs at
least once.
Either I am missing something important, or that patch claims something
that does not hold - at least upstream.
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-05 11:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-30 6:59 [PATCH] mm: fix: Uninitialized variable ret YANG LI
2020-12-30 7:10 ` Muchun Song
2021-01-05 11:03 ` David Hildenbrand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).