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]
Message-ID: <e0f268f7-d939-8732-af47-a9cd01025afe@gmail.com>
Date:   Wed, 26 Apr 2023 12:06:56 +0800
From:   Peng Zhang <perlyzhang@...il.com>
To:     "Liam R. Howlett" <Liam.Howlett@...cle.com>
Cc:     linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        maple-tree@...ts.infradead.org,
        David Binderman <dcb314@...mail.com>,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 01/34] maple_tree: Fix static analyser cppcheck issue


在 2023/4/25 22:09, Liam R. Howlett 写道:
> Static analyser of the maple tree code noticed that the split variable
> is being used to dereference into an array prior to checking the
> variable itself.  Fix this issue by changing the order of the statement
> to check the variable first.
>
> Reported-by: David Binderman <dcb314@...mail.com>
> Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>

Reviewed-by: Peng Zhang<zhangpeng.00@...edance.com>

> ---
>   lib/maple_tree.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index 110a36479dced..9cf4fca42310c 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -1943,8 +1943,9 @@ static inline int mab_calc_split(struct ma_state *mas,
>   		 * causes one node to be deficient.
>   		 * NOTE: mt_min_slots is 1 based, b_end and split are zero.
>   		 */
> -		while (((bn->pivot[split] - min) < slot_count - 1) &&
> -		       (split < slot_count - 1) && (b_end - split > slot_min))
> +		while ((split < slot_count - 1) &&
> +		       ((bn->pivot[split] - min) < slot_count - 1) &&
> +		       (b_end - split > slot_min))
>   			split++;
>   	}
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ