Skip to content

Commit

Permalink
x86, microcode, AMD: Correct buf references
Browse files Browse the repository at this point in the history
Both the equivalence table and the microcode patch types are u32. Access
them properly through the buf-ptr.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
  • Loading branch information
Borislav Petkov committed Jun 15, 2011
1 parent 2c53b43 commit 86b4456
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions arch/x86/kernel/microcode_amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static int apply_microcode_amd(int cpu)
static unsigned int verify_ucode_size(int cpu, const u8 *buf, unsigned int size)
{
struct cpuinfo_x86 *c = &cpu_data(cpu);
unsigned int max_size, actual_size;
u32 max_size, actual_size;

#define F1XH_MPB_MAX_SIZE 2048
#define F14H_MPB_MAX_SIZE 1824
Expand All @@ -175,7 +175,7 @@ static unsigned int verify_ucode_size(int cpu, const u8 *buf, unsigned int size)
break;
}

actual_size = buf[4] + (buf[5] << 8);
actual_size = *(u32 *)(buf + 4);

if (actual_size > size || actual_size > max_size) {
pr_err("section size mismatch\n");
Expand All @@ -191,7 +191,7 @@ get_next_ucode(int cpu, const u8 *buf, unsigned int size, unsigned int *mc_size)
struct microcode_header_amd *mc = NULL;
unsigned int actual_size = 0;

if (buf[0] != UCODE_UCODE_TYPE) {
if (*(u32 *)buf != UCODE_UCODE_TYPE) {
pr_err("invalid type field in container file section header\n");
goto out;
}
Expand Down

0 comments on commit 86b4456

Please sign in to comment.