linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Rolf Eike Beer <eb@emlix.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH 7/6] mm: pagewalk: add back missing variable initializations
Date: Wed, 24 Aug 2022 08:08:07 -0700	[thread overview]
Message-ID: <YwY+1xD52ep54M3y@dev-arch.thelio-3990X> (raw)
In-Reply-To: <2123960.ggj6I0NvhH@mobilepool36.emlix.com>

On Wed, Aug 24, 2022 at 01:00:11PM +0200, Rolf Eike Beer wrote:
> These initializations accidentially got lost during refactoring.
> 
> The first one can't actually be used without initialization, because
> walk_p4d_range() is only called when one of the 4 callbacks is set, but relying
> on this seems fragile.
> 
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Rolf Eike Beer <eb@emlix.com>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>  mm/pagewalk.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> Looks like my testing had just the right callbacks set so I never hit this. In 
> case you want to have this squashed into the original one just drop me a note 
> and I'll redo the whole series.
> 
> diff --git a/mm/pagewalk.c b/mm/pagewalk.c
> index d8be8a30b272..22e4bcca9bee 100644
> --- a/mm/pagewalk.c
> +++ b/mm/pagewalk.c
> @@ -223,7 +223,7 @@ static int walk_p4d_range(pgd_t *pgd, unsigned long addr, unsigned long end,
>  
>  	p4d = p4d_offset(pgd, addr);
>  	do {
> -		int err;
> +		int err = 0;
>  
>  		next = p4d_addr_end(addr, end);
>  		if (p4d_none_or_clear_bad(p4d)) {
> @@ -262,7 +262,7 @@ static int walk_pgd_range(unsigned long addr, unsigned long end,
>  	else
>  		pgd = pgd_offset(walk->mm, addr);
>  	do {
> -		int err;
> +		int err = 0;
>  
>  		next = pgd_addr_end(addr, end);
>  		if (pgd_none_or_clear_bad(pgd)) {
> @@ -308,7 +308,7 @@ static int walk_hugetlb_range(unsigned long addr, unsigned long end,
>  	const struct mm_walk_ops *ops = walk->ops;
>  
>  	for (; addr < end; addr = next) {
> -		int err;
> +		int err = 0;
>  		pte_t *pte = huge_pte_offset(walk->mm, addr & hmask, sz);
>  
>  		next = hugetlb_entry_end(h, addr, end);
> -- 
> 2.37.2
> 
> -- 
> Rolf Eike Beer, emlix GmbH, https://www.emlix.com
> Fon +49 551 30664-0, Fax +49 551 30664-11
> Gothaer Platz 3, 37083 Göttingen, Germany
> Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
> Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055
> 
> emlix - smart embedded open source
> 
> 


      reply	other threads:[~2022-08-24 15:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-22 12:59 [PATCH 0/6] Minor improvements for pagewalk code Rolf Eike Beer
2022-08-22 13:00 ` [PATCH 2/6] mm: pagewalk: don't check vma in walk_page_range_novma() Rolf Eike Beer
2022-08-22 13:01 ` [PATCH 3/6] mm: pagewalk: fix documentation of PTE hole handling Rolf Eike Beer
2022-08-22 13:02 ` [PATCH 4/6] mm: pagewalk: add api documentation for walk_page_range_novma() Rolf Eike Beer
2022-08-22 13:03 ` [PATCH 5/6] mm: pagewalk: allow walk_page_range_novma() without mm Rolf Eike Beer
2022-08-22 13:04 ` [PATCH 6/6] mm: pagewalk: move variables to more local scope, tweak loops Rolf Eike Beer
     [not found] ` <2203731.iZASKD2KPV@devpool047>
2022-08-22 20:53   ` [PATCH 1/6] mm: pagewalk: make error checks more obvious Andrew Morton
2022-08-24 11:00 ` [PATCH 7/6] mm: pagewalk: add back missing variable initializations Rolf Eike Beer
2022-08-24 15:08   ` Nathan Chancellor [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=YwY+1xD52ep54M3y@dev-arch.thelio-3990X \
    --to=nathan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=dan.carpenter@oracle.com \
    --cc=eb@emlix.com \
    --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