Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1730895 > unrolled thread

Re: [RFC] mm/memblock.c: using uninitialized value idx in memblock_add_range()

Started byMichal Hocko <mhocko@kernel.org>
First post2017-09-12 17:10 +0200
Last post2017-09-12 17:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFC] mm/memblock.c: using uninitialized value idx in  memblock_add_range() Michal Hocko <mhocko@kernel.org> - 2017-09-12 17:10 +0200

#1730895 — Re: [RFC] mm/memblock.c: using uninitialized value idx in memblock_add_range()

FromMichal Hocko <mhocko@kernel.org>
Date2017-09-12 17:10 +0200
SubjectRe: [RFC] mm/memblock.c: using uninitialized value idx in memblock_add_range()
Message-ID<uoUZ4-2RK-9@gated-at.bofh.it>
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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web