Re: [PATCH] staging: rtl8723bs: fix underflow logic in swing index calculations

From: Greg Kroah-Hartman

Date: Thu Jul 30 2026 - 05:57:22 EST


On Thu, Jul 30, 2026 at 02:20:04PM +0530, Mohit Mishra wrote:
> On Thu, Jul 30, 2026 at 1:10 PM Greg Kroah-Hartman
> <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> >
> > How was this issue found?
>
> I was going through drivers/staging/rtl8723bs looking for type-safety
> issues after noticing a similar pattern in another staging driver.
> I traced the swing index variables and noticed they're declared u8 but
> calculated from Absolute_OFDMSwingIdx, which is s8 and can be negative.
> I used an AI coding assistant to help organize the search and
> cross-check the branch logic, but verified the underflow behavior, the
> downstream truncation safety, and the TODO alignment myself by reading
> the actual code and running checkpatch/build checks locally.
>
> I don't have the hardware to confirm this in practice, which is why I
> noted it as compile-tested only.

You have to document when you use a LLM, please do so here in the
correct way.

thanks,

greg k-h