From: Quentin Casasnovas <quentin.casasnovas@oracle.com>
To: Borislav Petkov <bp@alien8.de>
Cc: X86 ML <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
Quentin Casasnovas <quentin.casasnovas@oracle.com>
Subject: Re: [PATCH 04/13] x86/microcode/intel: Simplify load_ucode_intel_bsp()
Date: Tue, 24 Feb 2015 17:21:51 +0100 [thread overview]
Message-ID: <20150224162151.GE4565@chrystal.uk.oracle.com> (raw)
In-Reply-To: <1424774232-5981-5-git-send-email-bp@alien8.de>
On Tue, Feb 24, 2015 at 11:37:03AM +0100, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
>
> Don't compute start and end from start and size in order to compute size
> again down the path in scan_microcode(). So pass size directly instead
> and simplify a bunch. Shorten variable names and remove useless ones.
>
> No functionality change.
>
Unless I can't read, which is likely to be true, I think I might have
spotted one.
> @@ -555,12 +555,10 @@ EXPORT_SYMBOL_GPL(save_mc_for_early);
>
> static __initdata char ucode_name[] = "kernel/x86/microcode/GenuineIntel.bin";
> static __init enum ucode_state
> -scan_microcode(unsigned long start, unsigned long end,
> - struct mc_saved_data *mc_saved_data,
> - unsigned long *mc_saved_in_initrd,
> - struct ucode_cpu_info *uci)
> +scan_microcode(unsigned long start, unsigned long size,
> + struct mc_saved_data *mc_saved_data,
> + unsigned long *mc_saved_in_initrd, struct ucode_cpu_info *uci)
> {
> - unsigned int size = end - start + 1;
... here `size = end - start + 1`, so basically the original size in
`hdr.ramdisk_image` *plus one*, whereas the `size` you're passing around
does not include it. I'm not saying it's wrong, quite the opposite I think
you're fixing an off-by-one error present in the original code at the same
time :)
> + u64 start, size;
> #ifdef CONFIG_X86_32
> - struct boot_params *boot_params_p;
> + struct boot_params *p;
>
> - boot_params_p = (struct boot_params *)__pa_nodebug(&boot_params);
> - ramdisk_image = boot_params_p->hdr.ramdisk_image;
> - ramdisk_size = boot_params_p->hdr.ramdisk_size;
> - initrd_start_early = ramdisk_image;
> - initrd_end_early = initrd_start_early + ramdisk_size;
> + p = (struct boot_params *)__pa_nodebug(&boot_params);
> + start = p->hdr.ramdisk_image;
> + size = p->hdr.ramdisk_size;
Here is your size.
Quentin
next prev parent reply other threads:[~2015-02-24 16:20 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-24 10:36 [PATCH 00/13] x86/microcode: Intel early loader cleanups Borislav Petkov
2015-02-24 10:37 ` [PATCH 01/13] x86/microcode/intel: Check if microcode was found before applying Borislav Petkov
2015-02-24 10:37 ` [PATCH 02/13] x86/microcode/intel: Do the mc_saved_src NULL check first Borislav Petkov
2015-02-24 16:20 ` Quentin Casasnovas
2015-02-24 10:37 ` [PATCH 03/13] x86/microcode/intel: Get rid of last arg to load_ucode_intel_bsp() Borislav Petkov
2015-02-24 16:21 ` Quentin Casasnovas
2015-02-24 18:30 ` Borislav Petkov
2015-02-24 10:37 ` [PATCH 04/13] x86/microcode/intel: Simplify load_ucode_intel_bsp() Borislav Petkov
2015-02-24 16:21 ` Quentin Casasnovas [this message]
2015-02-24 18:32 ` Borislav Petkov
2015-02-24 10:37 ` [PATCH 05/13] x86/microcode/intel: Make _save_mc() return the updated saved count Borislav Petkov
2015-02-24 16:22 ` Quentin Casasnovas
2015-02-24 10:37 ` [PATCH 06/13] x86/microcode/intel: Sanitize _save_mc() Borislav Petkov
2015-02-24 10:37 ` [PATCH 07/13] x86/microcode/intel: Rename update_match_revision() Borislav Petkov
2015-02-24 16:23 ` Quentin Casasnovas
2015-04-10 11:12 ` Borislav Petkov
2015-04-10 11:54 ` Quentin Casasnovas
2015-04-10 12:09 ` Borislav Petkov
2015-02-24 10:37 ` [PATCH 08/13] x86/microcode: Consolidate family,model, ... code Borislav Petkov
2015-02-24 16:23 ` Quentin Casasnovas
2015-02-24 10:37 ` [PATCH 09/13] x86/microcode/intel: Simplify generic_load_microcode_early() Borislav Petkov
2015-02-24 10:37 ` [PATCH 10/13] x86/microcode/intel: Move mc arg last in get_matching_{microcode|sig} Borislav Petkov
2015-02-24 16:24 ` Quentin Casasnovas
2015-05-05 9:14 ` Borislav Petkov
2015-02-24 10:37 ` [PATCH 11/13] x86/microcode/intel: Sanitize microcode_pointer() Borislav Petkov
2015-02-24 10:37 ` [PATCH 12/13] x86/microcode/intel: Check scan_microcode()'s retval Borislav Petkov
2015-02-24 10:37 ` [PATCH 13/13] x86/microcode/intel: Fix printing of microcode blobs in show_saved_mc() Borislav Petkov
2015-02-24 16:24 ` Quentin Casasnovas
2015-02-24 16:48 ` Borislav Petkov
2015-02-25 9:41 ` Quentin Casasnovas
2015-02-25 17:55 ` Borislav Petkov
2015-03-03 13:00 ` [tip:x86/microcode] x86/microcode/intel: Fix out of bounds memory access to the extended header tip-bot for Quentin Casasnovas
2015-02-24 16:40 ` [PATCH 00/13] x86/microcode: Intel early loader cleanups Quentin Casasnovas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150224162151.GE4565@chrystal.uk.oracle.com \
--to=quentin.casasnovas@oracle.com \
--cc=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox