x86/ucode/intel: Remove gratuitous memory allocations from cpu_request_microcode()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 20 Mar 2020 17:01:33 +0000 (17:01 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 1 Apr 2020 13:00:12 +0000 (14:00 +0100)
commitb362416637d1121e4c0bd25c48becb8b73765844
tree08ff2652b186f03d7e2e2f1348fdc18e0833d80a
parentdd6d059e25880aa59f2fc68446b6978aabc25bec
x86/ucode/intel: Remove gratuitous memory allocations from cpu_request_microcode()

cpu_request_microcode() needs to scan its container and duplicate one blob,
but the get_next_ucode_from_buffer() helper duplicates every blob in turn.
Furthermore, the length checking is only safe from overflow in 64bit builds.

Delete get_next_ucode_from_buffer() and alter the purpose of the saved
variable to simply point somewhere in buf until we're ready to return.

This is only a modest reduction in absolute code size, but avoids making
memory allocations for every blob in the container.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/cpu/microcode/intel.c