[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250424081454.2952632-1-qiuxu.zhuo@intel.com>
Date: Thu, 24 Apr 2025 16:14:54 +0800
From: Qiuxu Zhuo <qiuxu.zhuo@...el.com>
To: Tony Luck <tony.luck@...el.com>
Cc: Qiuxu Zhuo <qiuxu.zhuo@...el.com>,
Dan Carpenter <dan.carpenter@...aro.org>,
Borislav Petkov <bp@...en8.de>,
James Morse <james.morse@....com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Robert Richter <rric@...nel.org>,
Yi Lai <yi1.lai@...el.com>,
linux-edac@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 1/1] EDAC/i10nm: Fix the bitwise operation between variables of different sizes
The tool of Smatch static checker reported the following warning:
drivers/edac/i10nm_base.c:364 show_retry_rd_err_log()
warn: should bitwise negate be 'ullong'?
This warning was due to the bitwise NOT/AND operations between
'status_mask' (a u32 type) and 'log' (a u64 type), which resulted in
the high 32 bits of 'log' were cleared.
This was a false positive warning, as only the low 32 bits of 'log' was
written to the first RRL memory controller register (a u32 type).
To improve code sanity, fix this warning by changing 'status_mask' to
a u64 type, ensuring it matches the size of 'log' for bitwise operations.
Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
Closes: https://lore.kernel.org/all/aAih0KmEVq7ch6v2@stanley.mountain/
Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@...el.com>
---
This patch is on top of the RAS tree edac-for-next branch [1] with the
top commit [2].
[1] https://git.kernel.org/pub/scm/linux/kernel/git/ras/ras.git edac-for-next
[2] f53deda1a997 ("Merge branch 'edac-drivers' into edac-for-next")
drivers/edac/i10nm_base.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/edac/i10nm_base.c b/drivers/edac/i10nm_base.c
index 8863f1fb4caf..a3fca2567752 100644
--- a/drivers/edac/i10nm_base.c
+++ b/drivers/edac/i10nm_base.c
@@ -327,10 +327,10 @@ static void show_retry_rd_err_log(struct decoded_addr *res, char *msg,
{
int i, j, n, ch = res->channel, pch = res->cs & 1;
struct skx_imc *imc = &res->dev->imc[res->imc];
- u32 offset, status_mask;
+ u64 log, corr, status_mask;
struct reg_rrl *rrl;
- u64 log, corr;
bool scrub;
+ u32 offset;
u8 width;
if (!imc->mbase)
--
2.43.0
Powered by blists - more mailing lists