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] [day] [month] [year] [list]
Message-ID: <CADYq+fbbA+K6qsPSa73s94+Whe-_gZ0-ZquYjyx0S4RXFq1W-A@mail.gmail.com>
Date: Wed, 9 Apr 2025 15:06:58 +0100
From: Samuel Abraham <abrahamadekunle50@...il.com>
Cc: gregkh@...uxfoundation.org, julia.lawall@...ia.fr, 
	outreachy@...ts.linux.dev, linux-staging@...ts.linux.dev, 
	linux-kernel@...r.kernel.org, david.laight.linux@...il.com, andy@...nel.org, 
	dan.carpenter@...aro.org
Subject: Re: [PATCH v5] staging: rtl8723bs: Use % 4096u instead of & 0xfff

On Mon, Apr 7, 2025 at 5:17 PM Andy Shevchenko
<andy.shevchenko@...il.com> wrote:
>
> On Mon, Apr 7, 2025 at 6:54 PM Abraham Samuel Adekunle
> <abrahamadekunle50@...il.com> wrote:
> >
> > The sequence number is constrained to a range of [0, 4095], which
> > is a total of 4096 values. The bitmask operation using `& 0xfff` is
> > used to perform this wrap-around. While this is functionally correct,
> > it obscures the intended semantic of a 4096-based wrap.
> >
> > Using a modulo operation `% 4096u` makes the wrap-around logic
> > explicit and easier to understand. It clearly signals that the
> > sequence number cycles through a range of 4096 values.
> > It also makes the code robust against potential changes of the 4096
> > upper limit, especially when it becomes a non power of 2 value while
> > the AND(&) works solely for power of 2 values.
> >
> ...
>
> Besides that I haven't found in the changelog if you have looked at
> the entire driver code and checked that all usages of this field is
> done in the same / similar way and no need to convert anything more
> that these.

I have found more cases using a small Coccinelle semantic patch.
There were also cases in the media driver, but I did not touch those since it is
not allowed for an outreachy applicant.
I will send a patchset soon.

Thanks
Adekunle

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ