Commit bd8e39f9e4c0960541c8c69e1f7cb321574d7c90

Authored by Shaohua Li
Committed by Linus Torvalds
1 parent 9a4b9efa1d

[PATCH] x86 microcode: don't check the size

IA32 manual says if micorcode update's size is 0, then the size is
default size (2048 bytes). But this doesn't suggest all microcode
update's size should be above 2048 bytes to me. We actually had a
microcode update whose size is 1024 bytes. The patch just removed the
check.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Cc: Tigran Aivazian <tigran@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 1 changed file with 3 additions and 11 deletions Side-by-side Diff

arch/i386/kernel/microcode.c
... ... @@ -187,8 +187,7 @@
187 187  
188 188 total_size = get_totalsize(mc_header);
189 189 data_size = get_datasize(mc_header);
190   - if ((data_size + MC_HEADER_SIZE > total_size)
191   - || (data_size < DEFAULT_UCODE_DATASIZE)) {
  190 + if (data_size + MC_HEADER_SIZE > total_size) {
192 191 printk(KERN_ERR "microcode: error! "
193 192 "Bad data size in microcode data file\n");
194 193 return -EINVAL;
... ... @@ -365,8 +364,7 @@
365 364 return -EFAULT;
366 365 }
367 366 total_size = get_totalsize(&mc_header);
368   - if ((offset + total_size > user_buffer_size)
369   - || (total_size < DEFAULT_UCODE_TOTALSIZE)) {
  367 + if (offset + total_size > user_buffer_size) {
370 368 printk(KERN_ERR "microcode: error! Bad total size in microcode "
371 369 "data file\n");
372 370 return -EINVAL;
... ... @@ -432,11 +430,6 @@
432 430 {
433 431 ssize_t ret;
434 432  
435   - if (len < DEFAULT_UCODE_TOTALSIZE) {
436   - printk(KERN_ERR "microcode: not enough data\n");
437   - return -EINVAL;
438   - }
439   -
440 433 if ((len >> PAGE_SHIFT) > num_physpages) {
441 434 printk(KERN_ERR "microcode: too much data (max %ld pages)\n", num_physpages);
442 435 return -EINVAL;
... ... @@ -508,8 +501,7 @@
508 501 mc_header = (microcode_header_t *)(buf + offset);
509 502 total_size = get_totalsize(mc_header);
510 503  
511   - if ((offset + total_size > size)
512   - || (total_size < DEFAULT_UCODE_TOTALSIZE)) {
  504 + if (offset + total_size > size) {
513 505 printk(KERN_ERR "microcode: error! Bad data in microcode data file\n");
514 506 return -EINVAL;
515 507 }