Re: [PULL}: latest tip/cpus4096 changes

From: Ingo Molnar
Date: Fri Jan 16 2009 - 04:35:25 EST



* Mike Travis <travis@xxxxxxx> wrote:

> --- a/arch/x86/kernel/microcode_core.c
> +++ b/arch/x86/kernel/microcode_core.c
> @@ -104,7 +104,7 @@ static struct microcode_ops *microcode_ops;
> /* no concurrent ->write()s are allowed on /dev/cpu/microcode */
> static DEFINE_MUTEX(microcode_mutex);
>
> -struct ucode_cpu_info ucode_cpu_info[NR_CPUS];
> +struct ucode_cpu_info *ucode_cpu_info;
> EXPORT_SYMBOL_GPL(ucode_cpu_info);
>
> #ifdef CONFIG_MICROCODE_OLD_INTERFACE
> @@ -471,6 +471,13 @@ static int __init microcode_init(void)
> {
> struct cpuinfo_x86 *c = &cpu_data(0);
> int error;
> + size_t size = sizeof(*ucode_cpu_info) * nr_cpu_ids;
> +
> + ucode_cpu_info = kmalloc(size, GFP_KERNEL);
> + if (!ucode_cpu_info) {
> + WARN(1, "CPU: cannot allocate microcode info structure\n");
> + return -ENOMEM;
> + }
>
> if (c->x86_vendor == X86_VENDOR_INTEL)
> microcode_ops = init_intel_microcode();

look how this code continues:

else if (c->x86_vendor == X86_VENDOR_AMD)
microcode_ops = init_amd_microcode();

if (!microcode_ops) {
printk(KERN_ERR "microcode: no support for this CPU vendor\n");
return -ENODEV;
}

see the memory leak? Again, this patch too is trivially broken.

> commit beec9183a43f8a42f5b790326a3b120a3b513590
> Author: Mike Travis <travis@xxxxxxx>
> Date: Fri Jan 16 00:22:33 2009 -0800
>
> xen: reduce static memory usage

this one looks good in a quick check but please send it to Jeremy first or
get his Ack.

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/