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

From: Mohit Mishra

Date: Thu Jul 30 2026 - 04:56:33 EST


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.

Regards,
Mohit Mishra