Re: [PATCH v2 09/14] platform/x86/intel/ifs: Use generic microcode headers and functions

From: Borislav Petkov
Date: Fri Nov 11 2022 - 11:23:55 EST


On Mon, Nov 07, 2022 at 02:53:18PM -0800, Jithu Joseph wrote:
> static int scan_chunks_sanity_check(struct device *dev)
> {
> - int metadata_size, curr_pkg, cpu, ret = -ENOMEM;
> struct ifs_data *ifsd = ifs_get_data(dev);
> + int curr_pkg, cpu, ret = -ENOMEM;
> bool *package_authenticated;
> struct ifs_work local_work;
> - char *test_ptr;
>
> package_authenticated = kcalloc(topology_max_packages(), sizeof(bool), GFP_KERNEL);
> if (!package_authenticated)
> return ret;

Bah, how big is that thing so that you can't simply do a bitfield on the
stack here instead of kcalloc-ing?

> @@ -203,67 +174,33 @@ static int scan_chunks_sanity_check(struct device *dev)
> return ret;
> }
>
> -static int ifs_sanity_check(struct device *dev,
> - const struct microcode_header_intel *mc_header)
> +static int ifs_image_sanity_check(struct device *dev, const struct microcode_header_intel *data)

Yet another static function - no need for the ifs_ prefix.

...

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette