shithub: riscv

Download patch

ref: 2ef29e10f4157b90f0f4b5ce7f3bca551231ce02
parent: 1b7e120c090af2f8f0e17a664ba0e5e5d7f261a0
author: cinap_lenrek <[email protected]>
date: Mon Aug 3 13:07:40 EDT 2015

pc, pc64: replace atoi() calls with strtol() when hex can be expcte

--- a/sys/src/9/pc/archmp.c
+++ b/sys/src/9/pc/archmp.c
@@ -261,8 +261,8 @@
 	uchar* p;
 	char* s;
 	
-	size = atoi(getconf("*mp"));
-	if(size == 0) panic("mpoverride: invalid size in *mp");
+	size = strtol(getconf("*mp"), 0, 0);
+	if(size <= 0) panic("mpoverride: invalid size in *mp");
 	*newp = p = xalloc(size);
 	if(p == nil) panic("mpoverride: can't allocate memory");
 	*e = p + size;
--- a/sys/src/9/pc/devi82365.c
+++ b/sys/src/9/pc/devi82365.c
@@ -864,7 +864,7 @@
 
 		/* set vpp on card */
 		if(strncmp(buf, "vpp", 3) == 0)
-			wrreg(pp, Rpc, vcode(atoi(buf+3))|Fautopower|Foutena|Fcardena);
+			wrreg(pp, Rpc, vcode(strtol(buf+3, 0, 0))|Fautopower|Foutena|Fcardena);
 		return n;
 	case Qmem:
 	case Qattr:
--- a/sys/src/9/pc/etherm10g.c
+++ b/sys/src/9/pc/etherm10g.c
@@ -356,7 +356,7 @@
 
 	print("m10g: %d lanes; ecrc=%d; ", lanes, ecrc);
 	if(s = getconf("myriforce")){
-		i = atoi(s);
+		i = strtol(s, 0, 0);
 		if(i != 4*KiB || i != 2*KiB)
 			i = 2*KiB;
 		print("fw = %d [forced]\n", i);
@@ -390,7 +390,7 @@
 				c->ra[k] = strtoul(s+j+3*k, 0, 16);
 		}else if(strncmp(s+i, "SN=", 3) == 0){
 			bits ^= 2;
-			c->serial = atoi(s+i+3);
+			c->serial = strtoul(s+i+3, 0, 10);
 		}
 		i += l;
 	}