Re: [PATCH] ata: sata_mv: Fix incorrect string length computation in mv_dump_mem()

From: Damien Le Moal
Date: Mon Sep 11 2023 - 02:14:06 EST


On 9/5/23 04:54, Christophe JAILLET wrote:
> snprintf() returns the "number of characters which *would* be generated for
> the given input", not the size *really* generated.
>
> In order to avoid too large values for 'o' (and potential negative values
> for "sizeof(linebuf) o") use scnprintf() instead of snprintf().
>
> Note that given the "w < 4" in the for loop, the buffer can NOT
> overflow, but using the *right* function is always better.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>

Applied to for-6.6-fixes. Thanks !


--
Damien Le Moal
Western Digital Research