RE: [PATCH v2 1/2] EDAC/i5000: Fix snprintf() size calculation in calculate_dimm_size()

From: Zhuo, Qiuxu
Date: Tue Dec 09 2025 - 20:27:14 EST


> From: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Sent: Tuesday, December 9, 2025 10:37 PM
> To: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
> Cc: Borislav Petkov <bp@xxxxxxxxx>; Luck, Tony <tony.luck@xxxxxxxxx>;
> Aristeu Rozanski <arozansk@xxxxxxxxxx>; linux-edac@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx
> Subject: [PATCH v2 1/2] EDAC/i5000: Fix snprintf() size calculation in
> calculate_dimm_size()
>
> The snprintf() can't really overflow because we're writing a max of 42 bytes to
> a PAGE_SIZE buffer. But the limit calculation doesn't take the first 11 bytes
> that we wrote into consideration so the limit is not correct. Just fix it for
> correctness even though it doesn't affect runtime.
>
> Fixes: 64e1fdaf55d6 ("i5000_edac: Fix the logic that retrieves memory
> information")
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

LGTM. Thanks.

Reviewed-by: Qiuxu Zhuo <qiuxu.zhuo@xxxxxxxxx>