aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386')
-rw-r--r--arch/i386/kernel/microcode.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c
index 467901ebb992..9b9479768d5e 100644
--- a/arch/i386/kernel/microcode.c
+++ b/arch/i386/kernel/microcode.c
@@ -187,8 +187,7 @@ static int microcode_sanity_check(void *mc)
187 187
188 total_size = get_totalsize(mc_header); 188 total_size = get_totalsize(mc_header);
189 data_size = get_datasize(mc_header); 189 data_size = get_datasize(mc_header);
190 if ((data_size + MC_HEADER_SIZE > total_size) 190 if (data_size + MC_HEADER_SIZE > total_size) {
191 || (data_size < DEFAULT_UCODE_DATASIZE)) {
192 printk(KERN_ERR "microcode: error! " 191 printk(KERN_ERR "microcode: error! "
193 "Bad data size in microcode data file\n"); 192 "Bad data size in microcode data file\n");
194 return -EINVAL; 193 return -EINVAL;
@@ -365,8 +364,7 @@ static long get_next_ucode(void **mc, long offset)
365 return -EFAULT; 364 return -EFAULT;
366 } 365 }
367 total_size = get_totalsize(&mc_header); 366 total_size = get_totalsize(&mc_header);
368 if ((offset + total_size > user_buffer_size) 367 if (offset + total_size > user_buffer_size) {
369 || (total_size < DEFAULT_UCODE_TOTALSIZE)) {
370 printk(KERN_ERR "microcode: error! Bad total size in microcode " 368 printk(KERN_ERR "microcode: error! Bad total size in microcode "
371 "data file\n"); 369 "data file\n");
372 return -EINVAL; 370 return -EINVAL;
@@ -432,11 +430,6 @@ static ssize_t microcode_write (struct file *file, const char __user *buf, size_
432{ 430{
433 ssize_t ret; 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 if ((len >> PAGE_SHIFT) > num_physpages) { 433 if ((len >> PAGE_SHIFT) > num_physpages) {
441 printk(KERN_ERR "microcode: too much data (max %ld pages)\n", num_physpages); 434 printk(KERN_ERR "microcode: too much data (max %ld pages)\n", num_physpages);
442 return -EINVAL; 435 return -EINVAL;
@@ -508,8 +501,7 @@ static long get_next_ucode_from_buffer(void **mc, void *buf,
508 mc_header = (microcode_header_t *)(buf + offset); 501 mc_header = (microcode_header_t *)(buf + offset);
509 total_size = get_totalsize(mc_header); 502 total_size = get_totalsize(mc_header);
510 503
511 if ((offset + total_size > size) 504 if (offset + total_size > size) {
512 || (total_size < DEFAULT_UCODE_TOTALSIZE)) {
513 printk(KERN_ERR "microcode: error! Bad data in microcode data file\n"); 505 printk(KERN_ERR "microcode: error! Bad data in microcode data file\n");
514 return -EINVAL; 506 return -EINVAL;
515 } 507 }