Skip to content

Commit a7b5737

Browse files
Dan Carpenterbp3tk0v
authored andcommitted
RAS/AMD/ATL: Fix array overflow in get_logical_coh_st_fabric_id_mi300()
Check against ARRAY_SIZE() which is the number of elements instead of sizeof() which is the number of bytes. Fixes: 453f0ae ("RAS/AMD/ATL: Add MI300 support") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 453f0ae commit a7b5737

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/ras/amd/atl/denormalize.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ static const u16 phy_to_log_coh_st_map_mi300[] = {
405405

406406
static u16 get_logical_coh_st_fabric_id_mi300(struct addr_ctx *ctx)
407407
{
408-
if (ctx->inst_id >= sizeof(phy_to_log_coh_st_map_mi300)) {
408+
if (ctx->inst_id >= ARRAY_SIZE(phy_to_log_coh_st_map_mi300)) {
409409
atl_debug(ctx, "Instance ID out of range");
410410
return ~0;
411411
}

0 commit comments

Comments
 (0)