Skip to content

Commit 2b2408a

Browse files
qzhuo2aegl
authored andcommitted
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@linaro.org> Closes: https://lore.kernel.org/all/aAih0KmEVq7ch6v2@stanley.mountain/ Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com> Signed-off-by: Tony Luck <tony.luck@intel.com> Link: https://lore.kernel.org/r/20250424081454.2952632-1-qiuxu.zhuo@intel.com
1 parent 180f091 commit 2b2408a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/edac/i10nm_base.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,10 @@ static void show_retry_rd_err_log(struct decoded_addr *res, char *msg,
327327
{
328328
int i, j, n, ch = res->channel, pch = res->cs & 1;
329329
struct skx_imc *imc = &res->dev->imc[res->imc];
330-
u32 offset, status_mask;
330+
u64 log, corr, status_mask;
331331
struct reg_rrl *rrl;
332-
u64 log, corr;
333332
bool scrub;
333+
u32 offset;
334334
u8 width;
335335

336336
if (!imc->mbase)

0 commit comments

Comments
 (0)