[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <aTK9mKTphPwuR7qb@stanley.mountain>
Date: Fri, 5 Dec 2025 14:10:16 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Mauro Carvalho Chehab <mchehab@...nel.org>
Cc: Borislav Petkov <bp@...en8.de>, Tony Luck <tony.luck@...el.com>,
Aristeu Rozanski <arozansk@...hat.com>, linux-edac@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH] EDAC: fix a limit 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 my static checker complains because the
limit calculation doesn't take the first 11 bytes into consideration.
Fix this for the sake of correctness even though it doesn't affect
runtime.
Fixes: 68d086f89b80 ("i5400_edac: improve debug messages to better represent the filled memory")
Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
---
drivers/edac/i5400_edac.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/edac/i5400_edac.c b/drivers/edac/i5400_edac.c
index b5cf25905b05..81c93ba957a0 100644
--- a/drivers/edac/i5400_edac.c
+++ b/drivers/edac/i5400_edac.c
@@ -1033,6 +1033,7 @@ static void calculate_dimm_size(struct i5400_pvt *pvt)
n = snprintf(p, space, " ");
p += n;
+ space -= n;
for (branch = 0; branch < MAX_BRANCHES; branch++) {
n = snprintf(p, space, " branch %d | ", branch);
p += n;
--
2.51.0
Powered by blists - more mailing lists