Re: [PATCH 0/2] power: supply: sbs-battery: Fix the shared serial number buffer
From: Sebastian Reichel
Date: Mon Jul 27 2026 - 09:09:58 EST
On Sun, 26 Jul 2026 07:22:04 +0000, Babanpreet Singh wrote:
> The serial number of every sbs-battery instance is formatted into one
> file-scope buffer, so concurrent reads on two batteries can make one
> battery report the other's serial number. Patch 1 gives each device its
> own buffer.
>
> While rewriting that sprintf() call it became apparent that the
> conversion is also the only W=1 warning in this driver: the value is
> carried in an int and only its negative half is rejected, so gcc cannot
> prove that four hex digits fit the five-byte buffer. Patch 2 casts to
> the register's actual width. It is a separate patch because it is a
> distinct (and purely cosmetic) change - please just drop it if you would
> rather not carry it.
>
> [...]
Applied, thanks!
[1/2] power: supply: sbs-battery: Use a per-device serial number buffer
commit: 6027892925b8d19d2245c2d077e2ae35b49cc2b1
[2/2] power: supply: sbs-battery: Bound the serial number conversion to 16 bits
commit: 645448becbd0b52216c6741897dd412f9ff1b925
Best regards,
--
Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxx>