Skip to contentSkip to conversation

au1x00 prom.c hw addr case insensitivity fix

PATCH New Dan Hopper 1 participant 1 message Feb 5, 2003 MIPS

lore
Share & tools
lore

Dan Hopper

author
#0 lore raw

PATCH 1/1 au1x00 prom.c hw addr case insensitivity fix

Hi folks,

Attached please find a short fix to str2hexnum() in arch/mips/au1000/common/prom.c of the 2.4 branch. With this fix, the contents of the "ethaddr" entry in the environment table passed by the bootloader to the kernel can have upper case hexadecimal digits.

Without the patch, an address such as ethaddr = "00:50:C2:0C:20:4f" is silently converted to "00:50:02:00:20:4f", making for some serious head scratching if you're trying to bootp the kernel.

Dan

mips/au1000/common/prom.c renamed from mips/au1000/common/prom.c.orig +4 -2
@@ -105,9 +105,11 @@
 inline unsigned char str2hexnum(unsigned char c)
 {
 	if(c >= '0' && c <= '9')
-	return c - '0';
+		return c - '0';
 	if(c >= 'a' && c <= 'f')
-	return c - 'a' + 10;
+		return c - 'a' + 10;
+	if(c >= 'A' && c <= 'F')
+		return c - 'A' + 10;
 	return 0; /* foo */
 }