summaryrefslogtreecommitdiff
path: root/scripts/sorttable.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/sorttable.c')
-rw-r--r--scripts/sorttable.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/scripts/sorttable.c b/scripts/sorttable.c
index d7b50581c732..88e49a5c4251 100644
--- a/scripts/sorttable.c
+++ b/scripts/sorttable.c
@@ -322,10 +322,23 @@ static int parse_symbols(const char *fname)
return -1;
}
- while (fscanf(fp, "%16s %16s %c %*s\n", addr_str, size_str, &type) == 3) {
+ while (fscanf(fp, "%16s %16s %c%*[^\n]", addr_str, size_str, &type) == 3) {
uint64_t addr;
uint64_t size;
+ /*
+ * nm outputs size-less entries with a missing 2nd value, which
+ * means fscanf() just misread its fields.
+ *
+ * These don't matter as a call site cannot be in an empty
+ * function, so just skip them.
+ *
+ * nm pads address and size to the same width, so if their
+ * widths differ, this is a misread.
+ */
+ if (strlen(size_str) != strlen(addr_str))
+ continue;
+
/* Only care about functions */
if (type != 't' && type != 'T' && type != 'W')
continue;