lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 16 Sep 2009 08:23:29 +0800
From:	Wu Fengguang <fengguang.wu@...el.com>
To:	Hugh Dickins <hugh.dickins@...cali.co.uk>
Cc:	Andi Kleen <andi@...stfloor.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-mm@...ck.org" <linux-mm@...ck.org>
Subject: Re: [PATCH] hwpoison: fix uninitialized warning

On Wed, Sep 16, 2009 at 05:19:07AM +0800, Hugh Dickins wrote:
> Fix mmotm build warning, presumably also in linux-next:
> mm/memory.c: In function `do_swap_page':
> mm/memory.c:2498: warning: `pte' may be used uninitialized in this function
> 
> Signed-off-by: Hugh Dickins <hugh.dickins@...cali.co.uk>
> ---
> I've only noticed this warning on one machine, the powerpc: certainly it
> needs CONFIG_MIGRATION or CONFIG_MEMORY_FAILURE to see it, but I thought
> I had one of those set on other machines - just musing in case it's being
> masked elsewhere by some other bug...
> 
>  mm/memory.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- mmotm/mm/memory.c	2009-09-14 16:34:37.000000000 +0100
> +++ linux/mm/memory.c	2009-09-15 22:00:48.000000000 +0100
> @@ -2495,7 +2495,7 @@ static int do_swap_page(struct mm_struct
>  		} else if (is_hwpoison_entry(entry)) {
>  			ret = VM_FAULT_HWPOISON;
>  		} else {
> -			print_bad_pte(vma, address, pte, NULL);
> +			print_bad_pte(vma, address, orig_pte, NULL);
>  			ret = VM_FAULT_OOM;
>  		}

The lines was introduced in this patch:

        entry = pte_to_swp_entry(orig_pte);                                                                                          
-       if (is_migration_entry(entry)) {                                                                                             
-               migration_entry_wait(mm, pmd, address);                                                                              
+       if (unlikely(non_swap_entry(entry))) {                                                                                       
+               if (is_migration_entry(entry)) {                                                                                     
+                       migration_entry_wait(mm, pmd, address);                                                                      
+               } else if (is_hwpoison_entry(entry)) {                                                                               
+                       ret = VM_FAULT_HWPOISON;                                                                                     
+               } else {                                                                                                             
+                       print_bad_pte(vma, address, pte, NULL);                                                                      
+                       ret = VM_FAULT_OOM;                                                                                          
+               }                                                                                                                    
                goto out;                                                                                                            
        }                                                                                                                            

Given that currently there are only two types of non swap entries:
migration/hwpoison, the last 'else' block is in fact dead code..

Thanks,
Fengguang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ