Re: [PATCH v4 3/4] RAS/AMD/ATL: Validate address map when information is gathered
From: Borislav Petkov
Date: Tue May 28 2024 - 06:11:33 EST
On Mon, May 06, 2024 at 03:46:04PM +0000, John Allen wrote:
> +static int validate_address_map(struct addr_ctx *ctx)
> +{
> + switch (ctx->map.intlv_mode) {
> + case DF2_2CHAN_HASH:
> + case DF3_COD4_2CHAN_HASH:
> + case DF3_COD2_4CHAN_HASH:
> + case DF3_COD1_8CHAN_HASH:
> + if (!map_bits_valid(ctx, 8, 9, 1, 1))
> + goto out;
> + break;
> +
> + case DF4_NPS4_2CHAN_HASH:
> + case DF4_NPS2_4CHAN_HASH:
> + case DF4_NPS1_8CHAN_HASH:
> + case DF4p5_NPS4_2CHAN_1K_HASH:
> + case DF4p5_NPS4_2CHAN_2K_HASH:
> + case DF4p5_NPS2_4CHAN_1K_HASH:
> + case DF4p5_NPS2_4CHAN_2K_HASH:
> + case DF4p5_NPS1_8CHAN_1K_HASH:
> + case DF4p5_NPS1_8CHAN_2K_HASH:
> + case DF4p5_NPS1_16CHAN_1K_HASH:
> + case DF4p5_NPS1_16CHAN_2K_HASH:
> + if (!map_bits_valid(ctx, 8, 8, 1, 2))
> + goto out;
> + break;
> +
> + case MI3_HASH_8CHAN:
> + case MI3_HASH_16CHAN:
> + case MI3_HASH_32CHAN:
> + if (!map_bits_valid(ctx, 8, 8, 4, 1))
> + goto out;
> + break;
> +
> + /* Nothing to do for modes that don't need special validation checks. */
> + default:
> + break;
> + }
> +
> + return 0;
> +
> +out:
s/out/err/
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette