46 lines
1.9 KiB
Diff
46 lines
1.9 KiB
Diff
diff -urN irqbalance.orig/cpuinfo.c irqbalance/cpuinfo.c
|
|
--- irqbalance.orig/cpuinfo.c 2006-04-11 12:06:42.000000000 -0500
|
|
+++ irqbalance/cpuinfo.c 2006-04-11 13:02:51.000000000 -0500
|
|
@@ -37,16 +37,25 @@
|
|
assert(file != NULL);
|
|
while (!feof(file) && cpucount < MAX_CPU) {
|
|
fgets(linebuffer, 1024, file);
|
|
- if (strstr(linebuffer,"Physical processor ID\t:"))
|
|
+ if (strstr(linebuffer,"Physical processor ID\t:")) {
|
|
sscanf(linebuffer,"Physical processor ID\t: %ui", &cpunumber[cpucount]);
|
|
+ assert(cpunumber[cpucount] < MAX_CPU);
|
|
+ }
|
|
+
|
|
else if (strstr(linebuffer,"processor\t:"))
|
|
cpucount++;
|
|
- else if (strstr(linebuffer,"Number of siblings\t:"))
|
|
+ else if (strstr(linebuffer,"Number of siblings\t:")) {
|
|
sscanf(linebuffer,"Number of siblings \t: %i", &siblings[cpucount]);
|
|
- else if (strstr(linebuffer,"siblings\t:"))
|
|
+ assert(siblings[cpucount] < MAX_CPU);
|
|
+ }
|
|
+ else if (strstr(linebuffer,"siblings\t:")) {
|
|
sscanf(linebuffer,"siblings\t: %i", &siblings[cpucount]);
|
|
- else if (strstr(linebuffer,"physical id\t:"))
|
|
+ assert(siblings[cpucount] < MAX_CPU);
|
|
+ }
|
|
+ else if (strstr(linebuffer,"physical id\t:")) {
|
|
sscanf(linebuffer,"physical id\t: %ui", &cpunumber[cpucount]);
|
|
+ assert(cpunumber[cpucount] < MAX_CPU);
|
|
+ }
|
|
else if (strstr(linebuffer,"GenuineIntel")) {
|
|
if (!machineneedsbalance)
|
|
machineneedsbalance = 1;
|
|
Files irqbalance.orig/irqbalance and irqbalance/irqbalance differ
|
|
diff -urN irqbalance.orig/procinterrupts.c irqbalance/procinterrupts.c
|
|
--- irqbalance.orig/procinterrupts.c 2006-04-11 12:06:42.000000000 -0500
|
|
+++ irqbalance/procinterrupts.c 2006-04-11 13:03:03.000000000 -0500
|
|
@@ -102,6 +102,7 @@
|
|
ret = sscanf(word,"%i",&irqnumber);
|
|
if (!ret) /* non numeric end stuff */
|
|
irqnumber = MAX_INTERRUPTS-1;
|
|
+ assert(irqnumber < MAX_INTERRUPTS);
|
|
/* then N columns of counts, where N is the number of cpu's */
|
|
} else if (column <= cpucount) {
|
|
sscanf(word,"%lli",&count);
|