* [RFC] mm/memblock.c: using uninitialized value idx in memblock_add_range()
@ 2017-09-08 22:15 ` gurugio
0 siblings, 0 replies; 4+ messages in thread
From: gurugio @ 2017-09-08 22:15 UTC (permalink / raw)
To: linux-mm, linux-kernel; +Cc: Gioh Kim, Gioh Kim
From: Gioh Kim <gurugio@hanmail.net>
In memblock_add_range(), idx variable is a local value
but I cannot find initialization of idx value.
I checked idx value on my Qemu emulator. It was zero.
Is there any hidden initialization code?
Signed-off-by: Gioh Kim <gi-oh.kim@profitbricks.com>
---
mm/memblock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/memblock.c b/mm/memblock.c
index 7b8a5db..23374bc 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -515,7 +515,7 @@ int __init_memblock memblock_add_range(struct memblock_type *type,
bool insert = false;
phys_addr_t obase = base;
phys_addr_t end = base + memblock_cap_size(base, &size);
- int idx, nr_new;
+ int idx = 0, nr_new;
struct memblock_region *rgn;
if (!size)
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [RFC] mm/memblock.c: using uninitialized value idx in memblock_add_range()
@ 2017-09-08 22:15 ` gurugio
0 siblings, 0 replies; 4+ messages in thread
From: gurugio @ 2017-09-08 22:15 UTC (permalink / raw)
To: linux-mm, linux-kernel; +Cc: Gioh Kim, Gioh Kim
From: Gioh Kim <gurugio@hanmail.net>
In memblock_add_range(), idx variable is a local value
but I cannot find initialization of idx value.
I checked idx value on my Qemu emulator. It was zero.
Is there any hidden initialization code?
Signed-off-by: Gioh Kim <gi-oh.kim@profitbricks.com>
---
mm/memblock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/memblock.c b/mm/memblock.c
index 7b8a5db..23374bc 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -515,7 +515,7 @@ int __init_memblock memblock_add_range(struct memblock_type *type,
bool insert = false;
phys_addr_t obase = base;
phys_addr_t end = base + memblock_cap_size(base, &size);
- int idx, nr_new;
+ int idx = 0, nr_new;
struct memblock_region *rgn;
if (!size)
--
2.7.4
--
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 related [flat|nested] 4+ messages in thread
* Re: [RFC] mm/memblock.c: using uninitialized value idx in memblock_add_range()
2017-09-08 22:15 ` gurugio
@ 2017-09-12 15:07 ` Michal Hocko
-1 siblings, 0 replies; 4+ messages in thread
From: Michal Hocko @ 2017-09-12 15:07 UTC (permalink / raw)
To: gurugio; +Cc: linux-mm, linux-kernel, Gioh Kim, Gioh Kim
On Sat 09-09-17 00:15:33, gurugio@gmail.com wrote:
> From: Gioh Kim <gurugio@hanmail.net>
>
> In memblock_add_range(), idx variable is a local value
> but I cannot find initialization of idx value.
> I checked idx value on my Qemu emulator. It was zero.
> Is there any hidden initialization code?
Yes for_each_memblock_type. Ugly as hell! Something to clean up I guess.
Just make the index explicit argument of the macro.
>
> Signed-off-by: Gioh Kim <gi-oh.kim@profitbricks.com>
> ---
> mm/memblock.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/memblock.c b/mm/memblock.c
> index 7b8a5db..23374bc 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -515,7 +515,7 @@ int __init_memblock memblock_add_range(struct memblock_type *type,
> bool insert = false;
> phys_addr_t obase = base;
> phys_addr_t end = base + memblock_cap_size(base, &size);
> - int idx, nr_new;
> + int idx = 0, nr_new;
> struct memblock_region *rgn;
>
> if (!size)
> --
> 2.7.4
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC] mm/memblock.c: using uninitialized value idx in memblock_add_range()
@ 2017-09-12 15:07 ` Michal Hocko
0 siblings, 0 replies; 4+ messages in thread
From: Michal Hocko @ 2017-09-12 15:07 UTC (permalink / raw)
To: gurugio; +Cc: linux-mm, linux-kernel, Gioh Kim, Gioh Kim
On Sat 09-09-17 00:15:33, gurugio@gmail.com wrote:
> From: Gioh Kim <gurugio@hanmail.net>
>
> In memblock_add_range(), idx variable is a local value
> but I cannot find initialization of idx value.
> I checked idx value on my Qemu emulator. It was zero.
> Is there any hidden initialization code?
Yes for_each_memblock_type. Ugly as hell! Something to clean up I guess.
Just make the index explicit argument of the macro.
>
> Signed-off-by: Gioh Kim <gi-oh.kim@profitbricks.com>
> ---
> mm/memblock.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/memblock.c b/mm/memblock.c
> index 7b8a5db..23374bc 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -515,7 +515,7 @@ int __init_memblock memblock_add_range(struct memblock_type *type,
> bool insert = false;
> phys_addr_t obase = base;
> phys_addr_t end = base + memblock_cap_size(base, &size);
> - int idx, nr_new;
> + int idx = 0, nr_new;
> struct memblock_region *rgn;
>
> if (!size)
> --
> 2.7.4
--
Michal Hocko
SUSE Labs
--
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] 4+ messages in thread
end of thread, other threads:[~2017-09-12 15:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-08 22:15 [RFC] mm/memblock.c: using uninitialized value idx in memblock_add_range() gurugio
2017-09-08 22:15 ` gurugio
2017-09-12 15:07 ` Michal Hocko
2017-09-12 15:07 ` Michal Hocko
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.