Sven Schnelle (svens@stackframe.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1112
-gerrit
commit 835e0e6e494b719a8b66dd3cfd27278401cf9707 Author: Sven Schnelle svens@stackframe.org Date: Wed Jun 20 10:01:47 2012 +0200
mptable: Fix BUS type determination
Change-Id: I7268b35671f6629601fa3b2a589054b8c5da5d78 Signed-off-by: Sven Schnelle svens@stackframe.org --- util/mptable/mptable.c | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/util/mptable/mptable.c b/util/mptable/mptable.c index 80d4742..1aabe17 100644 --- a/util/mptable/mptable.c +++ b/util/mptable/mptable.c @@ -50,6 +50,7 @@ #include <unistd.h> #include <stdint.h>
+#define ARRAY_SIZE(_x) (sizeof(_x) / sizeof(_x[0])) #define SEP_LINE \ "\n-------------------------------------------------------------------------------\n"
@@ -982,7 +983,7 @@ static void busEntry(void) { char name[8]; BusEntry entry; - + int i; /* read it into local memory */ readEntry(&entry, sizeof(entry));
@@ -997,7 +998,21 @@ static void busEntry(void) }
memset(name, '\0', sizeof(name)); - strncpy(name, (char *)entry.busType, 6); + for(i = 0; i < 6; i++) { + switch(entry.busType[i]) { + case ' ': + case '\0': + break; + default: + name[i] = entry.busType[i]; + break; + } + } + + if (entry.busID > ARRAY_SIZE(busses)) { + fprintf(stderr, "busses array to small!\n"); + exit(1); + }
busses[entry.busID] = lookupBusType(name); printf("\tsmp_write_bus(mc, %d, "", entry.busID);
Dear Sven,
thanks for the patch! Great that you are back!
Am Mittwoch, den 20.06.2012, 10:07 +0200 schrieb Sven Schnelle:
Sven Schnelle (svens@stackframe.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1112
-gerrit
commit 835e0e6e494b719a8b66dd3cfd27278401cf9707 Author: Sven Schnelle svens@stackframe.org Date: Wed Jun 20 10:01:47 2012 +0200
mptable: Fix BUS type determination
Please add what problem is actually fixed. What was determined incorrectly?
Change-Id: I7268b35671f6629601fa3b2a589054b8c5da5d78 Signed-off-by: Sven Schnelle <svens@stackframe.org>
util/mptable/mptable.c | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/util/mptable/mptable.c b/util/mptable/mptable.c index 80d4742..1aabe17 100644 --- a/util/mptable/mptable.c +++ b/util/mptable/mptable.c @@ -50,6 +50,7 @@ #include <unistd.h> #include <stdint.h>
+#define ARRAY_SIZE(_x) (sizeof(_x) / sizeof(_x[0])) #define SEP_LINE \ "\n-------------------------------------------------------------------------------\n"
@@ -982,7 +983,7 @@ static void busEntry(void) { char name[8]; BusEntry entry;
- int i; /* read it into local memory */ readEntry(&entry, sizeof(entry));
@@ -997,7 +998,21 @@ static void busEntry(void) }
memset(name, '\0', sizeof(name));
- strncpy(name, (char *)entry.busType, 6);
- for(i = 0; i < 6; i++) {
Missing space before »(«?
switch(entry.busType[i]) {
case ' ':
case '\0':
break;
default:
name[i] = entry.busType[i];
break;
}
}
if (entry.busID > ARRAY_SIZE(busses)) {
fprintf(stderr, "busses array to small!\n");
exit(1);
}
busses[entry.busID] = lookupBusType(name); printf("\tsmp_write_bus(mc, %d, "", entry.busID);
Thanks,
Paul