Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753302AbbBXQUG (ORCPT ); Tue, 24 Feb 2015 11:20:06 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:28384 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752357AbbBXQUE (ORCPT ); Tue, 24 Feb 2015 11:20:04 -0500 Date: Tue, 24 Feb 2015 17:21:51 +0100 From: Quentin Casasnovas To: Borislav Petkov Cc: X86 ML , LKML , Quentin Casasnovas Subject: Re: [PATCH 04/13] x86/microcode/intel: Simplify load_ucode_intel_bsp() Message-ID: <20150224162151.GE4565@chrystal.uk.oracle.com> References: <1424774232-5981-1-git-send-email-bp@alien8.de> <1424774232-5981-5-git-send-email-bp@alien8.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1424774232-5981-5-git-send-email-bp@alien8.de> User-Agent: Mutt/1.5.22 (2013-10-16) X-Source-IP: ucsinet22.oracle.com [156.151.31.94] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2115 Lines: 55 On Tue, Feb 24, 2015 at 11:37:03AM +0100, Borislav Petkov wrote: > From: Borislav Petkov > > 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/