Commit bd8e39f9 authored by Shaohua Li's avatar Shaohua Li Committed by Linus Torvalds

[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: default avatarShaohua Li <shaohua.li@intel.com>
Cc: Tigran Aivazian <tigran@veritas.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9a4b9efa
...@@ -187,8 +187,7 @@ static int microcode_sanity_check(void *mc) ...@@ -187,8 +187,7 @@ static int microcode_sanity_check(void *mc)
total_size = get_totalsize(mc_header); total_size = get_totalsize(mc_header);
data_size = get_datasize(mc_header); data_size = get_datasize(mc_header);
if ((data_size + MC_HEADER_SIZE > total_size) if (data_size + MC_HEADER_SIZE > total_size) {
|| (data_size < DEFAULT_UCODE_DATASIZE)) {
printk(KERN_ERR "microcode: error! " printk(KERN_ERR "microcode: error! "
"Bad data size in microcode data file\n"); "Bad data size in microcode data file\n");
return -EINVAL; return -EINVAL;
...@@ -365,8 +364,7 @@ static long get_next_ucode(void **mc, long offset) ...@@ -365,8 +364,7 @@ static long get_next_ucode(void **mc, long offset)
return -EFAULT; return -EFAULT;
} }
total_size = get_totalsize(&mc_header); total_size = get_totalsize(&mc_header);
if ((offset + total_size > user_buffer_size) if (offset + total_size > user_buffer_size) {
|| (total_size < DEFAULT_UCODE_TOTALSIZE)) {
printk(KERN_ERR "microcode: error! Bad total size in microcode " printk(KERN_ERR "microcode: error! Bad total size in microcode "
"data file\n"); "data file\n");
return -EINVAL; return -EINVAL;
...@@ -432,11 +430,6 @@ static ssize_t microcode_write (struct file *file, const char __user *buf, size_ ...@@ -432,11 +430,6 @@ static ssize_t microcode_write (struct file *file, const char __user *buf, size_
{ {
ssize_t ret; ssize_t ret;
if (len < DEFAULT_UCODE_TOTALSIZE) {
printk(KERN_ERR "microcode: not enough data\n");
return -EINVAL;
}
if ((len >> PAGE_SHIFT) > num_physpages) { if ((len >> PAGE_SHIFT) > num_physpages) {
printk(KERN_ERR "microcode: too much data (max %ld pages)\n", num_physpages); printk(KERN_ERR "microcode: too much data (max %ld pages)\n", num_physpages);
return -EINVAL; return -EINVAL;
...@@ -508,8 +501,7 @@ static long get_next_ucode_from_buffer(void **mc, void *buf, ...@@ -508,8 +501,7 @@ static long get_next_ucode_from_buffer(void **mc, void *buf,
mc_header = (microcode_header_t *)(buf + offset); mc_header = (microcode_header_t *)(buf + offset);
total_size = get_totalsize(mc_header); total_size = get_totalsize(mc_header);
if ((offset + total_size > size) if (offset + total_size > size) {
|| (total_size < DEFAULT_UCODE_TOTALSIZE)) {
printk(KERN_ERR "microcode: error! Bad data in microcode data file\n"); printk(KERN_ERR "microcode: error! Bad data in microcode data file\n");
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment