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:   Sat, 13 Oct 2018 13:04:45 -0400
From:   Pavel Tatashin <pasha.tatashin@...il.com>
To:     penghao122@...a.com.cn
Cc:     Linux Memory Management List <linux-mm@...ck.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        pasha.tatashin@...cle.com, osalvador@...e.de,
        LKML <linux-kernel@...r.kernel.org>, peng.hao2@....com.cn
Subject: Re: [PATCH] mm/sparse: remove a check that compare if unsigned
 variable is negative

This is incorrect: next_present_section_nr() returns "int" and -1 no
next section, this change would lead to infinite loop.
On Sat, Oct 13, 2018 at 12:16 PM Peng Hao <penghao122@...a.com.cn> wrote:
>
>
> From: Peng Hao <peng.hao2@....com.cn>
>
> In all use locations for for_each_present_section_nr, variable
> section_nr is unsigned. It is unnecessary to test if it is negative.
>
> Signed-off-by: Peng Hao <peng.hao2@....com.cn>
> ---
>  mm/sparse.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 10b07ee..a6f9f22 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -196,8 +196,7 @@ static inline int next_present_section_nr(int section_nr)
>  }
>  #define for_each_present_section_nr(start, section_nr)         \
>         for (section_nr = next_present_section_nr(start-1);     \
> -            ((section_nr >= 0) &&                              \
> -             (section_nr <= __highest_present_section_nr));    \
> +            section_nr <= __highest_present_section_nr;        \
>              section_nr = next_present_section_nr(section_nr))
>
>  static inline unsigned long first_present_section_nr(void)
> --
> 1.8.3.1
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ