x86, microcode, AMD: Replace vmalloc+memset with vzalloc
authorJesper Juhl <jj@chaosbits.net>
Mon, 1 Nov 2010 21:44:34 +0000 (22:44 +0100)
committerBorislav Petkov <borislav.petkov@amd.com>
Wed, 10 Nov 2010 13:48:57 +0000 (14:48 +0100)
We don't have to do memset() ourselves after vmalloc() when we have
vzalloc(), so change that in
arch/x86/kernel/microcode_amd.c::get_next_ucode().

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
arch/x86/kernel/microcode_amd.c

index e1af7c055c7d0c86c7e3a1fe789e597825185892..383d4f8ec9e112ba99beee09ea7c1053e075393c 100644 (file)
@@ -183,16 +183,17 @@ get_next_ucode(const u8 *buf, unsigned int size, unsigned int *mc_size)
                return NULL;
        }
 
-       mc = vmalloc(UCODE_MAX_SIZE);
-       if (mc) {
-               memset(mc, 0, UCODE_MAX_SIZE);
-               if (get_ucode_data(mc, buf + UCODE_CONTAINER_SECTION_HDR,
-                                  total_size)) {
-                       vfree(mc);
-                       mc = NULL;
-               } else
-                       *mc_size = total_size + UCODE_CONTAINER_SECTION_HDR;
+       mc = vzalloc(UCODE_MAX_SIZE);
+       if (!mc)
+               return NULL;
+
+       if (get_ucode_data(mc, buf + UCODE_CONTAINER_SECTION_HDR, total_size)) {
+               vfree(mc);
+               mc = NULL;
+       } else {
+               *mc_size = total_size + UCODE_CONTAINER_SECTION_HDR;
        }
+
        return mc;
 }