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:   Mon, 10 Apr 2023 16:23:42 +0800
From:   Peng Zhang <zhangpeng.00@...edance.com>
To:     David Binderman <dcb314@...mail.com>
Cc:     "Liam.Howlett@...cle.com" <Liam.Howlett@...cle.com>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        maple-tree@...ts.infradead.org
Subject: Re: linux-6.3-rc6/lib/maple_tree.c: Two style issues


在 2023/4/10 15:05, David Binderman 写道:
> Hello there,
>
> Static analyser cppcheck says:
>
> 1.
>
> linux-6.3-rc6/lib/maple_tree.c:1951:21: style: Array index 'split' is used before limits check. [arrayIndexThenCheck]
>
> Source code is
>
>          while (((bn->pivot[split] - min) < slot_count - 1) &&
>                 (split < slot_count - 1) && (b_end - split > slot_min))
>
> Suggest move limits check to before use.

Hi,

It should be fine here. The upper bound of split is b_end.
The initial state (split = b_end / 2) must not cross the boundary,
and (b_end - split > slot_min) ensures that it will not cross the 
boundary in the future.

>
> 2.
>
> linux-6.3-rc6/lib/maple_tree.c:3289:11: warning: Size of pointer 'pivs' used instead of size of its data. [pointerSize]
>
> Source code is
>
>             memset(pivs + tmp, 0,
>                     sizeof(unsigned long *) * (max_p - tmp));

It's not good here, I can fix it.

Thanks.

>
> but
>
>      unsigned long *l_pivs, *pivs, gap;
>
> Pointers and long don't have to be the same size. Suggest code rework.
>
> Regards
>
> David Binderman
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ