[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <07cd652c51e77aad5a8350e1a7cd9407e5bbe373.1765290801.git.dan.carpenter@linaro.org>
Date: Tue, 9 Dec 2025 17:36:59 +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
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@...aro.org>
---
v2: new patch
drivers/edac/i5000_edac.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/edac/i5000_edac.c b/drivers/edac/i5000_edac.c
index 4a1bebc1ff14..471b8540d18b 100644
--- a/drivers/edac/i5000_edac.c
+++ b/drivers/edac/i5000_edac.c
@@ -1111,6 +1111,7 @@ static void calculate_dimm_size(struct i5000_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