[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9ec1c919-504a-a50a-4f75-5a1ab63b1ab5@kernel.org>
Date: Mon, 11 Sep 2023 15:14:00 +0900
From: Damien Le Moal <dlemoal@...nel.org>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
linux-ide@...r.kernel.org
Subject: Re: [PATCH] ata: sata_mv: Fix incorrect string length computation in
mv_dump_mem()
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@...adoo.fr>
Applied to for-6.6-fixes. Thanks !
--
Damien Le Moal
Western Digital Research
Powered by blists - more mailing lists