All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] dmi: fix date handling in dmi_get_year()
@ 2009-08-16 12:01 Tejun Heo
  2009-08-16 12:02 ` [PATCH 2/4] dmi: extend dmi_get_year() to dmi_get_date() Tejun Heo
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Tejun Heo @ 2009-08-16 12:01 UTC (permalink / raw)
  To: Sandor Bodo-Merle, Huang, Shane, Jeff Garzik, ide; +Cc: Andrew Morton

Year parsing in dmi_get_year() had the following two bugs.

* "00" is treated as invalid instead of 2000 because zero return from
  simple_strtoul() is treated as error.

* "0N" where N >= 8 is treated as invalid of 200N because the leading
  0 is considered to specify octal.

Fix the above two bugs by using endptr to detect invalid number and
forcing decimal.

Signed-off-by: Tejun Heo <tj@kernel.org>
---
While trying to implement dmi_get_date(), spotted two bugs in the
current dmi_get_year().  Tricky date strings.  ;-P

I think it would be safer to postpone this and the next patch for the
next merge window.  There's no reported case of these bugs causing
problems yet, so no reason to risk behavior change at this stage.  If
nobody objects, it would be easiest to push this through
libata-dev#upstream.

Thanks.

 drivers/firmware/dmi_scan.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Index: ata/drivers/firmware/dmi_scan.c
===================================================================
--- ata.orig/drivers/firmware/dmi_scan.c
+++ ata/drivers/firmware/dmi_scan.c
@@ -577,6 +577,7 @@ int dmi_get_year(int field)
 {
 	int year;
 	const char *s = dmi_get_system_info(field);
+	char *e;
 
 	if (!s)
 		return -1;
@@ -587,8 +588,8 @@ int dmi_get_year(int field)
 		return 0;
 
 	s += 1;
-	year = simple_strtoul(s, NULL, 0);
-	if (year && year < 100) {	/* 2-digit year */
+	year = simple_strtoul(s, &e, 10);
+	if (s != e && year < 100) {	/* 2-digit year */
 		year += 1900;
 		if (year < 1996)	/* no dates < spec 1.0 */
 			year += 100;

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

* [PATCH 2/4] dmi: extend dmi_get_year() to dmi_get_date()
  2009-08-16 12:01 [PATCH 1/4] dmi: fix date handling in dmi_get_year() Tejun Heo
@ 2009-08-16 12:02 ` Tejun Heo
  2009-08-16 12:03   ` [PATCH 3/4 #upstream] ahci: make ahci_asus_m2a_vm_32bit_only() quirk more generic Tejun Heo
  2009-08-16 12:04   ` [PATCH 3/4 #upstream] ahci: make ahci_asus_m2a_vm_32bit_only() quirk more generic Tejun Heo
  2009-08-16 12:11 ` [PATCH 1/4] dmi: fix date handling in dmi_get_year() Jeff Garzik
  2009-09-09  1:19 ` Jeff Garzik
  2 siblings, 2 replies; 7+ messages in thread
From: Tejun Heo @ 2009-08-16 12:02 UTC (permalink / raw)
  To: Sandor Bodo-Merle, Huang, Shane, Jeff Garzik, ide; +Cc: Andrew Morton

There are cases where full date information is required instead of
just the year.  Add month and day parsing to dmi_get_year() and rename
it to dmi_get_date().

As the original function only required '/' followed by any number of
parseable characters at the end of the string, keep that behavior to
avoid upsetting existing users.

The new function takes dates of format [mm[/dd]]/yy[yy].  Year, month
and date are checked to be in the ranges of [1-9999], [1-12] and
[1-31] respectively and any invalid or out-of-range component is
returned as zero.

The dummy implementation is updated accordingly but the return value
is updated to indicate field not found which is consistent with how
other dummy functions behave.

Signed-off-by: Tejun Heo <tj@kernel.org>
---
 arch/x86/pci/direct.c       |    5 +-
 drivers/acpi/blacklist.c    |    5 +-
 drivers/ata/ahci.c          |    2 -
 drivers/firmware/dmi_scan.c |   78 +++++++++++++++++++++++++++++++++-----------
 include/linux/dmi.h         |   13 ++++++-
 5 files changed, 77 insertions(+), 26 deletions(-)

Index: ata/drivers/firmware/dmi_scan.c
===================================================================
--- ata.orig/drivers/firmware/dmi_scan.c
+++ ata/drivers/firmware/dmi_scan.c
@@ -568,36 +568,76 @@ const struct dmi_device * dmi_find_devic
 EXPORT_SYMBOL(dmi_find_device);
 
 /**
- *	dmi_get_year - Return year of a DMI date
- *	@field:	data index (like dmi_get_system_info)
+ *	dmi_get_date - parse a DMI date
+ *	@field:	data index (see enum dmi_field)
+ *	@yearp: optional out parameter for the year
+ *	@monthp: optional out parameter for the month
+ *	@dayp: optional out parameter for the day
  *
- *	Returns -1 when the field doesn't exist. 0 when it is broken.
+ *	The date field is assumed to be in the form resembling
+ *	[mm[/dd]]/yy[yy] and the result is stored in the out
+ *	parameters any or all of which can be omitted.
+ *
+ *	If the field doesn't exist, all out parameters are set to zero
+ *	and false is returned.  Otherwise, true is returned with any
+ *	invalid part of date set to zero.
+ *
+ *	On return, year, month and day are guaranteed to be in the
+ *	range of [0,9999], [0,12] and [0,31] respectively.
  */
-int dmi_get_year(int field)
+bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp)
 {
-	int year;
-	const char *s = dmi_get_system_info(field);
+	int year = 0, month = 0, day = 0;
+	bool exists;
+	const char *s, *y;
 	char *e;
 
-	if (!s)
-		return -1;
-	if (*s == '\0')
-		return 0;
-	s = strrchr(s, '/');
-	if (!s)
-		return 0;
-
-	s += 1;
-	year = simple_strtoul(s, &e, 10);
-	if (s != e && year < 100) {	/* 2-digit year */
+	s = dmi_get_system_info(field);
+	exists = s;
+	if (!exists)
+		goto out;
+
+	/*
+	 * Determine year first.  We assume the date string resembles
+	 * mm/dd/yy[yy] but the original code extracted only the year
+	 * from the end.  Keep the behavior in the spirit of no
+	 * surprises.
+	 */
+	y = strrchr(s, '/');
+	if (!y)
+		goto out;
+
+	y++;
+	year = simple_strtoul(y, &e, 10);
+	if (y != e && year < 100) {	/* 2-digit year */
 		year += 1900;
 		if (year < 1996)	/* no dates < spec 1.0 */
 			year += 100;
 	}
+	if (year > 9999)		/* year should fit in %04d */
+		year = 0;
+
+	/* parse the mm and dd */
+	month = simple_strtoul(s, &e, 10);
+	if (s == e || *e != '/' || !month || month > 12) {
+		month = 0;
+		goto out;
+	}
 
-	return year;
+	s = e + 1;
+	day = simple_strtoul(s, &e, 10);
+	if (s == y || s == e || *e != '/' || day > 31)
+		day = 0;
+out:
+	if (yearp)
+		*yearp = year;
+	if (monthp)
+		*monthp = month;
+	if (dayp)
+		*dayp = day;
+	return exists;
 }
-EXPORT_SYMBOL(dmi_get_year);
+EXPORT_SYMBOL(dmi_get_date);
 
 /**
  *	dmi_walk - Walk the DMI table and get called back for every record
Index: ata/include/linux/dmi.h
===================================================================
--- ata.orig/include/linux/dmi.h
+++ ata/include/linux/dmi.h
@@ -43,7 +43,7 @@ extern const char * dmi_get_system_info(
 extern const struct dmi_device * dmi_find_device(int type, const char *name,
 	const struct dmi_device *from);
 extern void dmi_scan_machine(void);
-extern int dmi_get_year(int field);
+extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp);
 extern int dmi_name_in_vendors(const char *str);
 extern int dmi_name_in_serial(const char *str);
 extern int dmi_available;
@@ -58,7 +58,16 @@ static inline const char * dmi_get_syste
 static inline const struct dmi_device * dmi_find_device(int type, const char *name,
 	const struct dmi_device *from) { return NULL; }
 static inline void dmi_scan_machine(void) { return; }
-static inline int dmi_get_year(int year) { return 0; }
+static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp)
+{
+	if (yearp)
+		*yearp = 0;
+	if (monthp)
+		*monthp = 0;
+	if (dayp)
+		*dayp = 0;
+	return false;
+}
 static inline int dmi_name_in_vendors(const char *s) { return 0; }
 static inline int dmi_name_in_serial(const char *s) { return 0; }
 #define dmi_available 0
Index: ata/arch/x86/pci/direct.c
===================================================================
--- ata.orig/arch/x86/pci/direct.c
+++ ata/arch/x86/pci/direct.c
@@ -192,13 +192,14 @@ struct pci_raw_ops pci_direct_conf2 = {
 static int __init pci_sanity_check(struct pci_raw_ops *o)
 {
 	u32 x = 0;
-	int devfn;
+	int year, devfn;
 
 	if (pci_probe & PCI_NO_CHECKS)
 		return 1;
 	/* Assume Type 1 works for newer systems.
 	   This handles machines that don't have anything on PCI Bus 0. */
-	if (dmi_get_year(DMI_BIOS_DATE) >= 2001)
+	dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL);
+	if (year >= 2001)
 		return 1;
 
 	for (devfn = 0; devfn < 0x100; devfn++) {
Index: ata/drivers/acpi/blacklist.c
===================================================================
--- ata.orig/drivers/acpi/blacklist.c
+++ ata/drivers/acpi/blacklist.c
@@ -78,9 +78,10 @@ static struct acpi_blacklist_item acpi_b
 
 static int __init blacklist_by_year(void)
 {
-	int year = dmi_get_year(DMI_BIOS_DATE);
+	int year;
+
 	/* Doesn't exist? Likely an old system */
-	if (year == -1) {
+	if (!dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL)) {
 		printk(KERN_ERR PREFIX "no DMI BIOS year, "
 			"acpi=force is required to enable ACPI\n" );
 		return 1;
Index: ata/drivers/ata/ahci.c
===================================================================
--- ata.orig/drivers/ata/ahci.c
+++ ata/drivers/ata/ahci.c
@@ -2635,7 +2635,7 @@ static bool ahci_asus_m2a_vm_32bit_only(
 	 * different versions.
 	 */
 	date = dmi_get_system_info(DMI_BIOS_DATE);
-	year = dmi_get_year(DMI_BIOS_DATE);
+	dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL);
 	if (date && strlen(date) >= 10 && date[2] == '/' && date[5] == '/' &&
 	    (year > 2007 ||
 	     (year == 2007 && strncmp(date, cutoff_mmdd, 5) >= 0)))

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

* [PATCH 3/4 #upstream] ahci: make ahci_asus_m2a_vm_32bit_only() quirk more generic
  2009-08-16 12:02 ` [PATCH 2/4] dmi: extend dmi_get_year() to dmi_get_date() Tejun Heo
@ 2009-08-16 12:03   ` Tejun Heo
  2009-08-16 12:06     ` [PATCH 4/4 #upstream] ahci: Gigabyte GA-MA69VM-S2 can't do 64bit DMA Tejun Heo
  2009-08-16 12:04   ` [PATCH 3/4 #upstream] ahci: make ahci_asus_m2a_vm_32bit_only() quirk more generic Tejun Heo
  1 sibling, 1 reply; 7+ messages in thread
From: Tejun Heo @ 2009-08-16 12:03 UTC (permalink / raw)
  To: Sandor Bodo-Merle, Huang, Shane, Jeff Garzik, ide; +Cc: Andrew Morton

It turns out ASUS M2A-VM isn't the only one with the 32bit DMA
problem.  Make ahci_asus_m2a_vm_32bit_only() more generic using the
new dmi_get_date() and rename it to ahci_sb600_32bit_only().  Cut off
date is now pointed to by dmi_system_id->driver_data in "yyyymmdd"
format and it's now also allowed to be omitted.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Sandor Bodo-Merle <sbodomerle@gmail.com>
Cc: Shane Huang <shane.huang@amd.com>
---
 drivers/ata/ahci.c |   55 ++++++++++++++++++++++++++++-------------------------
 1 file changed, 30 insertions(+), 25 deletions(-)

Index: ata/drivers/ata/ahci.c
===================================================================
--- ata.orig/drivers/ata/ahci.c
+++ ata/drivers/ata/ahci.c
@@ -2603,14 +2603,18 @@ static void ahci_p5wdh_workaround(struct
 }
 
 /*
- * SB600 ahci controller on ASUS M2A-VM can't do 64bit DMA with older
- * BIOS.  The oldest version known to be broken is 0901 and working is
- * 1501 which was released on 2007-10-26.  Force 32bit DMA on anything
- * older than 1501.  Please read bko#9412 for more info.
+ * SB600 ahci controller on certain boards can't do 64bit DMA with
+ * older BIOS.
  */
-static bool ahci_asus_m2a_vm_32bit_only(struct pci_dev *pdev)
+static bool ahci_sb600_32bit_only(struct pci_dev *pdev)
 {
 	static const struct dmi_system_id sysids[] = {
+		/*
+		 * The oldest version known to be broken is 0901 and
+		 * working is 1501 which was released on 2007-10-26.
+		 * Force 32bit DMA on anything older than 1501.
+		 * Please read bko#9412 for more info.
+		 */
 		{
 			.ident = "ASUS M2A-VM",
 			.matches = {
@@ -2618,31 +2622,32 @@ static bool ahci_asus_m2a_vm_32bit_only(
 					  "ASUSTeK Computer INC."),
 				DMI_MATCH(DMI_BOARD_NAME, "M2A-VM"),
 			},
+			.driver_data = "20071026",	/* yyyymmdd */
 		},
 		{ }
 	};
-	const char *cutoff_mmdd = "10/26";
-	const char *date;
-	int year;
+	const struct dmi_system_id *match;
 
+	match = dmi_first_match(sysids);
 	if (pdev->bus->number != 0 || pdev->devfn != PCI_DEVFN(0x12, 0) ||
-	    !dmi_check_system(sysids))
-		return false;
-
-	/*
-	 * Argh.... both version and date are free form strings.
-	 * Let's hope they're using the same date format across
-	 * different versions.
-	 */
-	date = dmi_get_system_info(DMI_BIOS_DATE);
-	dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL);
-	if (date && strlen(date) >= 10 && date[2] == '/' && date[5] == '/' &&
-	    (year > 2007 ||
-	     (year == 2007 && strncmp(date, cutoff_mmdd, 5) >= 0)))
+	    !match)
 		return false;
 
-	dev_printk(KERN_WARNING, &pdev->dev, "ASUS M2A-VM: BIOS too old, "
-		   "forcing 32bit DMA, update BIOS\n");
+	if (match->driver_data) {
+		int year, month, date;
+		char buf[9];
+
+		dmi_get_date(DMI_BIOS_DATE, &year, &month, &date);
+		snprintf(buf, sizeof(buf), "%04d%02d%02d", year, month, date);
+
+		if (strcmp(buf, match->driver_data) >= 0)
+			return false;
+
+		dev_printk(KERN_WARNING, &pdev->dev, "%s: BIOS too old, "
+			   "forcing 32bit DMA, update BIOS\n", match->ident);
+	} else
+		dev_printk(KERN_WARNING, &pdev->dev, "%s: this board can't "
+			   "do 64bit DMA, forcing 32bit\n", match->ident);
 
 	return true;
 }
@@ -2857,8 +2862,8 @@ static int ahci_init_one(struct pci_dev
 	if (board_id == board_ahci_sb700 && pdev->revision >= 0x40)
 		hpriv->flags &= ~AHCI_HFLAG_IGN_SERR_INTERNAL;
 
-	/* apply ASUS M2A_VM quirk */
-	if (ahci_asus_m2a_vm_32bit_only(pdev))
+	/* apply sb600 32bit only quirk */
+	if (ahci_sb600_32bit_only(pdev))
 		hpriv->flags |= AHCI_HFLAG_32BIT_ONLY;
 
 	if (!(hpriv->flags & AHCI_HFLAG_NO_MSI))

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

* [PATCH 3/4 #upstream] ahci: make ahci_asus_m2a_vm_32bit_only() quirk more generic
  2009-08-16 12:02 ` [PATCH 2/4] dmi: extend dmi_get_year() to dmi_get_date() Tejun Heo
  2009-08-16 12:03   ` [PATCH 3/4 #upstream] ahci: make ahci_asus_m2a_vm_32bit_only() quirk more generic Tejun Heo
@ 2009-08-16 12:04   ` Tejun Heo
  1 sibling, 0 replies; 7+ messages in thread
From: Tejun Heo @ 2009-08-16 12:04 UTC (permalink / raw)
  To: Sandor Bodo-Merle, Huang, Shane, Jeff Garzik, ide; +Cc: Andrew Morton

It turns out ASUS M2A-VM isn't the only one with the 32bit DMA
problem.  Make ahci_asus_m2a_vm_32bit_only() more generic using the
new dmi_get_date() and rename it to ahci_sb600_32bit_only().  Cut off
date is now pointed to by dmi_system_id->driver_data in "yyyymmdd"
format and it's now also allowed to be omitted.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Sandor Bodo-Merle <sbodomerle@gmail.com>
Cc: Shane Huang <shane.huang@amd.com>
---
 drivers/ata/ahci.c |   55 ++++++++++++++++++++++++++++-------------------------
 1 file changed, 30 insertions(+), 25 deletions(-)

Index: ata/drivers/ata/ahci.c
===================================================================
--- ata.orig/drivers/ata/ahci.c
+++ ata/drivers/ata/ahci.c
@@ -2603,14 +2603,18 @@ static void ahci_p5wdh_workaround(struct
 }
 
 /*
- * SB600 ahci controller on ASUS M2A-VM can't do 64bit DMA with older
- * BIOS.  The oldest version known to be broken is 0901 and working is
- * 1501 which was released on 2007-10-26.  Force 32bit DMA on anything
- * older than 1501.  Please read bko#9412 for more info.
+ * SB600 ahci controller on certain boards can't do 64bit DMA with
+ * older BIOS.
  */
-static bool ahci_asus_m2a_vm_32bit_only(struct pci_dev *pdev)
+static bool ahci_sb600_32bit_only(struct pci_dev *pdev)
 {
 	static const struct dmi_system_id sysids[] = {
+		/*
+		 * The oldest version known to be broken is 0901 and
+		 * working is 1501 which was released on 2007-10-26.
+		 * Force 32bit DMA on anything older than 1501.
+		 * Please read bko#9412 for more info.
+		 */
 		{
 			.ident = "ASUS M2A-VM",
 			.matches = {
@@ -2618,31 +2622,32 @@ static bool ahci_asus_m2a_vm_32bit_only(
 					  "ASUSTeK Computer INC."),
 				DMI_MATCH(DMI_BOARD_NAME, "M2A-VM"),
 			},
+			.driver_data = "20071026",	/* yyyymmdd */
 		},
 		{ }
 	};
-	const char *cutoff_mmdd = "10/26";
-	const char *date;
-	int year;
+	const struct dmi_system_id *match;
 
+	match = dmi_first_match(sysids);
 	if (pdev->bus->number != 0 || pdev->devfn != PCI_DEVFN(0x12, 0) ||
-	    !dmi_check_system(sysids))
-		return false;
-
-	/*
-	 * Argh.... both version and date are free form strings.
-	 * Let's hope they're using the same date format across
-	 * different versions.
-	 */
-	date = dmi_get_system_info(DMI_BIOS_DATE);
-	dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL);
-	if (date && strlen(date) >= 10 && date[2] == '/' && date[5] == '/' &&
-	    (year > 2007 ||
-	     (year == 2007 && strncmp(date, cutoff_mmdd, 5) >= 0)))
+	    !match)
 		return false;
 
-	dev_printk(KERN_WARNING, &pdev->dev, "ASUS M2A-VM: BIOS too old, "
-		   "forcing 32bit DMA, update BIOS\n");
+	if (match->driver_data) {
+		int year, month, date;
+		char buf[9];
+
+		dmi_get_date(DMI_BIOS_DATE, &year, &month, &date);
+		snprintf(buf, sizeof(buf), "%04d%02d%02d", year, month, date);
+
+		if (strcmp(buf, match->driver_data) >= 0)
+			return false;
+
+		dev_printk(KERN_WARNING, &pdev->dev, "%s: BIOS too old, "
+			   "forcing 32bit DMA, update BIOS\n", match->ident);
+	} else
+		dev_printk(KERN_WARNING, &pdev->dev, "%s: this board can't "
+			   "do 64bit DMA, forcing 32bit\n", match->ident);
 
 	return true;
 }
@@ -2857,8 +2862,8 @@ static int ahci_init_one(struct pci_dev
 	if (board_id == board_ahci_sb700 && pdev->revision >= 0x40)
 		hpriv->flags &= ~AHCI_HFLAG_IGN_SERR_INTERNAL;
 
-	/* apply ASUS M2A_VM quirk */
-	if (ahci_asus_m2a_vm_32bit_only(pdev))
+	/* apply sb600 32bit only quirk */
+	if (ahci_sb600_32bit_only(pdev))
 		hpriv->flags |= AHCI_HFLAG_32BIT_ONLY;
 
 	if (!(hpriv->flags & AHCI_HFLAG_NO_MSI))

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

* [PATCH 4/4 #upstream] ahci: Gigabyte GA-MA69VM-S2 can't do 64bit DMA
  2009-08-16 12:03   ` [PATCH 3/4 #upstream] ahci: make ahci_asus_m2a_vm_32bit_only() quirk more generic Tejun Heo
@ 2009-08-16 12:06     ` Tejun Heo
  0 siblings, 0 replies; 7+ messages in thread
From: Tejun Heo @ 2009-08-16 12:06 UTC (permalink / raw)
  To: Sandor Bodo-Merle, Huang, Shane, Jeff Garzik, ide; +Cc: Andrew Morton

Gigabyte GA-MA69VM-S2 can't do 64bit DMA either.  It's yet unknown
whether recent BIOS fixes the problem.  Blacklist regardless of BIOS
revisions for now.

Sandor Bodo-Merle reported and provided the initial patch for this
issue.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Sandor Bodo-Merle <sbodomerle@gmail.com>
Cc: Shane Huang <shane.huang@amd.com>
---
Sandor, sorry that I ended up redoing this series but without proper
dmi_get_date() it was too ugly.  Your second patch was fine but it
just didn't look right with the manual date parsing callback.

Thanks.

 drivers/ata/ahci.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Index: ata/drivers/ata/ahci.c
===================================================================
--- ata.orig/drivers/ata/ahci.c
+++ ata/drivers/ata/ahci.c
@@ -2624,6 +2624,22 @@ static bool ahci_sb600_32bit_only(struct
 			},
 			.driver_data = "20071026",	/* yyyymmdd */
 		},
+		/*
+		 * It's yet unknown whether more recent BIOS fixes the
+		 * problem.  Blacklist the whole board for the time
+		 * being.  Please read the following thread for more
+		 * info.
+		 *
+		 * http://thread.gmane.org/gmane.linux.ide/42326
+		 */
+		{
+			.ident = "Gigabyte GA-MA69VM-S2",
+			.matches = {
+				DMI_MATCH(DMI_BOARD_VENDOR,
+					  "Gigabyte Technology Co., Ltd."),
+				DMI_MATCH(DMI_BOARD_NAME, "GA-MA69VM-S2"),
+			},
+		},
 		{ }
 	};
 	const struct dmi_system_id *match;

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

* Re: [PATCH 1/4] dmi: fix date handling in dmi_get_year()
  2009-08-16 12:01 [PATCH 1/4] dmi: fix date handling in dmi_get_year() Tejun Heo
  2009-08-16 12:02 ` [PATCH 2/4] dmi: extend dmi_get_year() to dmi_get_date() Tejun Heo
@ 2009-08-16 12:11 ` Jeff Garzik
  2009-09-09  1:19 ` Jeff Garzik
  2 siblings, 0 replies; 7+ messages in thread
From: Jeff Garzik @ 2009-08-16 12:11 UTC (permalink / raw)
  To: Tejun Heo, Andrew Morton; +Cc: Sandor Bodo-Merle, Huang, Shane, ide

Tejun Heo wrote:
> Year parsing in dmi_get_year() had the following two bugs.
> 
> * "00" is treated as invalid instead of 2000 because zero return from
>   simple_strtoul() is treated as error.
> 
> * "0N" where N >= 8 is treated as invalid of 200N because the leading
>   0 is considered to specify octal.
> 
> Fix the above two bugs by using endptr to detect invalid number and
> forcing decimal.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> ---
> While trying to implement dmi_get_date(), spotted two bugs in the
> current dmi_get_year().  Tricky date strings.  ;-P
> 
> I think it would be safer to postpone this and the next patch for the
> next merge window.  There's no reported case of these bugs causing
> problems yet, so no reason to risk behavior change at this stage.  If
> nobody objects, it would be easiest to push this through
> libata-dev#upstream.
> 
> Thanks.
> 
>  drivers/firmware/dmi_scan.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Patchset looks good to me...   To make life easy, I would prefer to 
carry patches 1-2 in libata-dev#upstream, as well as patches 3-4.  If 
there are objections to that plan from anyone, speak now...  :)


	Jeff





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

* Re: [PATCH 1/4] dmi: fix date handling in dmi_get_year()
  2009-08-16 12:01 [PATCH 1/4] dmi: fix date handling in dmi_get_year() Tejun Heo
  2009-08-16 12:02 ` [PATCH 2/4] dmi: extend dmi_get_year() to dmi_get_date() Tejun Heo
  2009-08-16 12:11 ` [PATCH 1/4] dmi: fix date handling in dmi_get_year() Jeff Garzik
@ 2009-09-09  1:19 ` Jeff Garzik
  2 siblings, 0 replies; 7+ messages in thread
From: Jeff Garzik @ 2009-09-09  1:19 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Sandor Bodo-Merle, Huang, Shane, ide, Andrew Morton

On 08/16/2009 08:01 AM, Tejun Heo wrote:
> Year parsing in dmi_get_year() had the following two bugs.
>
> * "00" is treated as invalid instead of 2000 because zero return from
>    simple_strtoul() is treated as error.
>
> * "0N" where N>= 8 is treated as invalid of 200N because the leading
>    0 is considered to specify octal.
>
> Fix the above two bugs by using endptr to detect invalid number and
> forcing decimal.
>
> Signed-off-by: Tejun Heo<tj@kernel.org>
> ---
> While trying to implement dmi_get_date(), spotted two bugs in the
> current dmi_get_year().  Tricky date strings.  ;-P
>
> I think it would be safer to postpone this and the next patch for the
> next merge window.  There's no reported case of these bugs causing
> problems yet, so no reason to risk behavior change at this stage.  If
> nobody objects, it would be easiest to push this through
> libata-dev#upstream.
>
> Thanks.
>
>   drivers/firmware/dmi_scan.c |    5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)

applied 1-4



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

end of thread, other threads:[~2009-09-09  1:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-16 12:01 [PATCH 1/4] dmi: fix date handling in dmi_get_year() Tejun Heo
2009-08-16 12:02 ` [PATCH 2/4] dmi: extend dmi_get_year() to dmi_get_date() Tejun Heo
2009-08-16 12:03   ` [PATCH 3/4 #upstream] ahci: make ahci_asus_m2a_vm_32bit_only() quirk more generic Tejun Heo
2009-08-16 12:06     ` [PATCH 4/4 #upstream] ahci: Gigabyte GA-MA69VM-S2 can't do 64bit DMA Tejun Heo
2009-08-16 12:04   ` [PATCH 3/4 #upstream] ahci: make ahci_asus_m2a_vm_32bit_only() quirk more generic Tejun Heo
2009-08-16 12:11 ` [PATCH 1/4] dmi: fix date handling in dmi_get_year() Jeff Garzik
2009-09-09  1:19 ` Jeff Garzik

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.