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>] [day] [month] [year] [list]
Message-ID: <20231103073459.GN2824@kernel.org>
Date:   Fri, 3 Nov 2023 09:34:59 +0200
From:   Mike Rapoport <rppt@...nel.org>
To:     黄亮亮 <huanglllzu@...il.com>
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        akpm@...ux-foundation.org, Liangliang Huang <huangll@...ote.com>
Subject: Re: [PATCH] mm/memblock.c: using judgment statement can reduce loop
 and enhance readability.

On Fri, Nov 03, 2023 at 01:30:21PM +0800, 黄亮亮 wrote:
> Hi,this patch can less loop once in this situation:
> base more than rbase and end less than rend.
>                 base           end
>     rbase-----|--------------|-------rend
>       |            |                 |           |
> -------------------------------------------------------->

The loop won't be executed anyway because there's similar condition in the
beginning of the loop. 

Next time when you reply to the kernel mailing lists, please don't top post
and make sure your reply is text-only.

And there is no need to send 4 badly formatted replies.
 
> Mike Rapoport <rppt@...nel.org> 于2023年11月2日周四 16:54写道:
> 
>     Hi,
> 
>     > Subject: [PATCH] mm/memblock.c: using judgment statement can reduce loop
>     and enhance readability.
> 
>     I disagree.
> 
>     On Thu, Nov 02, 2023 at 10:37:10AM +0800, huanglllzu@...il.com wrote:
>     > From: Liangliang Huang <huangll@...ote.com>
>     >
>     > Signed-off-by: Liangliang Huang <huangll@...ote.com>
>     > ---
>     >  mm/memblock.c | 6 +++++-
>     >  1 file changed, 5 insertions(+), 1 deletion(-)
>     >
>     > diff --git a/mm/memblock.c b/mm/memblock.c
>     > index 913b2520a9a0..e48dea7144bb 100644
>     > --- a/mm/memblock.c
>     > +++ b/mm/memblock.c
>     > @@ -655,7 +655,11 @@ static int __init_memblock memblock_add_range(struct
>     memblock_type *type,
>     >                       }
>     >               }
>     >               /* area below @rend is dealt with, forget about it */
>     > -             base = min(rend, end);
>     > +             if (end < rend) {
>     > +                     base = end;
>     > +                     break;
>     > +             } else
>     > +                     base = rend;
> 
>     min() is perfectly clear and there no change in number of iterations of the
>     loop.
> 
>     >       }
>     > 
>     >       /* insert the remaining portion */
>     > --
>     > 2.25.1
>     >
> 
>     --
>     Sincerely yours,
>     Mike.
> 

-- 
Sincerely yours,
Mike.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ