Re: [PATCH 2/3] x86/microcode/AMD: Make __verify_patch_size() return bool
From: Nikolay Borisov
Date: Thu Nov 14 2024 - 09:41:04 EST
On 14.11.24 г. 16:26 ч., Borislav Petkov wrote:
On Thu, Nov 14, 2024 at 04:13:33PM +0200, Nikolay Borisov wrote:
if (sh_psize != max_size)
return false;
Isn't sh_psize < max_size valid here?
* sh_psize < min_t(u32, buf_size, max_size) == max_size -- ditto.
This is still some sort of a mismatch which we'd rather fail.
That max_size should probably be called patch_size or so.
IOW, if the patch size in the header doesn't match the per-family patch size
=> fail.
Right, the important bit here is that max_size is not really max_size
but, as you say, patch_size so for those families it's expected to have
an exact size.
With max_size I perceive it would imply that the current patch can be
_at most_ max_size, but might as well be smaller.