public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86 microcode: don't check the size
@ 2006-09-07  2:47 Shaohua Li
  2006-09-07  4:18 ` Jeff Garzik
  0 siblings, 1 reply; 3+ messages in thread
From: Shaohua Li @ 2006-09-07  2:47 UTC (permalink / raw)
  To: lkml; +Cc: Andrew Morton, Tigran Aivazian

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>

---
 work/src/linux-2.6.18-rc5-mm1/arch/i386/kernel/microcode.c |   14 ++-----------
 1 files changed, 3 insertions(+), 11 deletions(-)

Index: root/work/src/linux-2.6.18-rc5-mm1/arch/i386/kernel/microcode.c
===================================================================
--- root.orig/work/src/linux-2.6.18-rc5-mm1/arch/i386/kernel/microcode.c	2006-09-06 06:51:03.000000000 +0800
+++ root/work/src/linux-2.6.18-rc5-mm1/arch/i386/kernel/microcode.c	2006-09-06 08:20:35.000000000 +0800
@@ -187,8 +187,7 @@ static int microcode_sanity_check(void *
 
 	total_size = get_totalsize(mc_header);
 	data_size = get_datasize(mc_header);
-	if ((data_size + MC_HEADER_SIZE > total_size)
-		|| (data_size < DEFAULT_UCODE_DATASIZE)) {
+	if (data_size + MC_HEADER_SIZE > total_size) {
 		printk(KERN_ERR "microcode: error! "
 			"Bad data size in microcode data file\n");
 		return -EINVAL;
@@ -365,8 +364,7 @@ static long get_next_ucode(void **mc, lo
 		return -EFAULT;
 	}
 	total_size = get_totalsize(&mc_header);
-	if ((offset + total_size > user_buffer_size)
-		|| (total_size < DEFAULT_UCODE_TOTALSIZE)) {
+	if (offset + total_size > user_buffer_size) {
 		printk(KERN_ERR "microcode: error! Bad total size in microcode "
 				"data file\n");
 		return -EINVAL;
@@ -432,11 +430,6 @@ static ssize_t microcode_write (struct f
 {
 	ssize_t ret;
 
-	if (len < DEFAULT_UCODE_TOTALSIZE) {
-		printk(KERN_ERR "microcode: not enough data\n"); 
-		return -EINVAL;
-	}
-
 	if ((len >> PAGE_SHIFT) > num_physpages) {
 		printk(KERN_ERR "microcode: too much data (max %ld pages)\n", num_physpages);
 		return -EINVAL;
@@ -508,8 +501,7 @@ static long get_next_ucode_from_buffer(v
 	mc_header = (microcode_header_t *)(buf + offset);
 	total_size = get_totalsize(mc_header);
 
-	if ((offset + total_size > size)
-		|| (total_size < DEFAULT_UCODE_TOTALSIZE)) {
+	if (offset + total_size > size) {
 		printk(KERN_ERR "microcode: error! Bad data in microcode data file\n");
 		return -EINVAL;
 	}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86 microcode: don't check the size
  2006-09-07  2:47 [PATCH] x86 microcode: don't check the size Shaohua Li
@ 2006-09-07  4:18 ` Jeff Garzik
  2006-09-07  5:14   ` Shaohua Li
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Garzik @ 2006-09-07  4:18 UTC (permalink / raw)
  To: Shaohua Li; +Cc: lkml, Andrew Morton, Tigran Aivazian

Shaohua Li wrote:
> 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>

Why not explicitly check for zero, rather than removing the questionable 
less-than test?  The default size logic hasn't disappeared...

	Jeff




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86 microcode: don't check the size
  2006-09-07  4:18 ` Jeff Garzik
@ 2006-09-07  5:14   ` Shaohua Li
  0 siblings, 0 replies; 3+ messages in thread
From: Shaohua Li @ 2006-09-07  5:14 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: lkml, Andrew Morton, Tigran Aivazian

On Thu, 2006-09-07 at 00:18 -0400, Jeff Garzik wrote:
> Shaohua Li wrote:
> > 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>
> 
> Why not explicitly check for zero, rather than removing the questionable 
> less-than test?  The default size logic hasn't disappeared...
We just don't want the default size check. If the size is 0, we still
need use default size. The patch is just for those whose size isn't 0
but smaller than default size.

Thanks,
Shaohua

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-09-07  5:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-07  2:47 [PATCH] x86 microcode: don't check the size Shaohua Li
2006-09-07  4:18 ` Jeff Garzik
2006-09-07  5:14   ` Shaohua Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox