Hi, I found a small time bug in prom_getenv() for which I like to share the fix with y'all. prom_envp is an array with two elements per environment variable. So for instance element 0 is memsize and element 1 is 0x08000000 for the environment variable memsize=0x08000000. The code for prom_getenv() only skips one element when it's in search for the next environment variable. It should of course step two elements. I found this error in two files and for both I include a patch to fix the problem. Signed-off-by: Freddy Spierenburg <freddy@xxxxxxxxxxxxxxx> -- $ cat ~/.signature Freddy Spierenburg <freddy@xxxxxxxxxxxxxxx> http://freddy.snarl.nl/ GnuPG: 0x7941D1E1=C948 5851 26D2 FA5C 39F1 E588 6F17 FD5D 7941 D1E1 $ # Please read http://www.ietf.org/rfc/rfc2015.txt before complain!
diff -Naur linux.orig/arch/mips/philips/pnx8550/common/prom.c linux/arch/mips/philips/pnx8550/common/prom.c --- linux.orig/arch/mips/philips/pnx8550/common/prom.c 2006-03-22 15:25:58.000000000 +0000 +++ linux/arch/mips/philips/pnx8550/common/prom.c 2006-03-22 15:25:23.000000000 +0000 @@ -70,7 +70,7 @@ if(strncmp(envname, env->name, i) == 0) { return(env->name + strlen(envname) + 1); } - env++; + env+=2; } return(NULL); }
diff -Naur linux.orig/arch/mips/au1000/common/prom.c linux/arch/mips/au1000/common/prom.c --- linux.orig/arch/mips/au1000/common/prom.c 2006-03-22 15:11:09.000000000 +0000 +++ linux/arch/mips/au1000/common/prom.c 2006-03-22 15:16:22.000000000 +0000 @@ -97,7 +97,7 @@ if(strncmp(envname, env->name, i) == 0) { return(env->name + strlen(envname) + 1); } - env++; + env+=2; } return(NULL); }
Attachment:
signature.asc
Description: Digital signature