From: Michal Hocko <mhocko@kernel.org>
To: gurugio@gmail.com
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Gioh Kim <gurugio@hanmail.net>,
Gioh Kim <gi-oh.kim@profitbricks.com>
Subject: Re: [RFC] mm/memblock.c: using uninitialized value idx in memblock_add_range()
Date: Tue, 12 Sep 2017 17:07:37 +0200 [thread overview]
Message-ID: <20170912150737.envdkppnpx5xskfy@dhcp22.suse.cz> (raw)
In-Reply-To: <1504908933-31667-1-git-send-email-gurugio@gmail.com>
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>
prev parent reply other threads:[~2017-09-12 15:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-08 22:15 gurugio
2017-09-12 15:07 ` Michal Hocko [this message]
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=20170912150737.envdkppnpx5xskfy@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=gi-oh.kim@profitbricks.com \
--cc=gurugio@gmail.com \
--cc=gurugio@hanmail.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox