[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <45476946-f717-49f5-8d21-34ea146bd624@suswa.mountain>
Date: Sun, 20 Jul 2025 21:03:28 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Alok Tiwari <alok.a.tiwari@...cle.com>
Cc: linux-staging@...ts.linux.dev, marvin24@....de,
gregkh@...uxfoundation.org, ac100@...ts.launchpad.net,
linux-tegra@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: nvec: Fix incorrect null termination of battery
manufacturer
On Sat, Jul 19, 2025 at 01:07:42AM -0700, Alok Tiwari wrote:
> The battery manufacturer string was incorrectly null terminated using
> bat_model instead of bat_manu. This could result in an unintended
> write to the wrong field and potentially incorrect behavior.
>
> fixe the issue by correctly null terminating the bat_manu string.
>
> Fixes: 32890b983086 ("Staging: initial version of the nvec driver")
> Signed-off-by: Alok Tiwari <alok.a.tiwari@...cle.com>
> ---
Nice. How did you find this copy and paste bug? I guess we could write
a static checker rule that if you do a copy followed by setting a NUL
terminator, they have to be the same string buffer.
KTODO: detect copy and paste bugs setting the NUL terminator
Reviewed-by: Dan Carpenter <dan.carpenter@...aro.org>
regards,
dan capenter
Powered by blists - more mailing lists