Skip to content

Commit 79c0a2b

Browse files
Dan Carpenterbp3tk0v
authored andcommitted
EDAC/versalnet: Fix off by one in handle_error()
The priv->mci[] array has NUM_CONTROLLERS so this > comparison needs to be >= to prevent an out of bounds access. Fixes: d5fe2fe ("EDAC: Add a driver for the AMD Versal NET DDR controller") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Yazen Ghannam <[email protected]>
1 parent 3a86608 commit 79c0a2b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/edac/versalnet_edac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ static void handle_error(struct mc_priv *priv, struct ecc_status *stat,
433433
phys_addr_t pfn;
434434
int err;
435435

436-
if (WARN_ON_ONCE(ctl_num > NUM_CONTROLLERS))
436+
if (WARN_ON_ONCE(ctl_num >= NUM_CONTROLLERS))
437437
return;
438438

439439
mci = priv->mci[ctl_num];

0 commit comments

Comments
 (0)