Re: [GIT PULL] microcode loader updates

From: Borislav Petkov
Date: Mon Mar 02 2015 - 08:31:09 EST


On Mon, Mar 02, 2015 at 02:03:36PM +0100, Quentin Casasnovas wrote:
> So at the last loop iteration for j == i, we'll do kfree(saved_ptr[j])
> which AFAICT hasn't been initialized yet. Using a kcalloc() your first
> allocation for saved_ptr should just work since the memory will be cleared
> and kfree(NULL) doesn't do anything.

You're correct, but(!)...

Practically, this is not a problem because @mc_saved_src being handed
down to save_microcode() is at both call sites initialized up to
mc_saved_count elements and the loop in save_microcode() only inspects
this far.

So actually, this test is not really needed:

if (!mc_saved_src[i]) {
ret = -EINVAL;
goto err;
}

AFAICT and if I'm not missing anything else, of course.

In any case, I'd like to keep this series cleanup-only (well, except
this one) and address your comments later. Don't worry, I haven't
forgotten them - I want to *not* fix everything in one go.

Agreed?

--
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--
--
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/