diff options
Diffstat (limited to 'elfutils/libdwfl/dwfl_module.c')
-rw-r--r-- | elfutils/libdwfl/dwfl_module.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/elfutils/libdwfl/dwfl_module.c b/elfutils/libdwfl/dwfl_module.c index 3ccf8b16..16c616d2 100644 --- a/elfutils/libdwfl/dwfl_module.c +++ b/elfutils/libdwfl/dwfl_module.c @@ -109,7 +109,7 @@ dwfl_report_begin (Dwfl *dwfl) } INTDEF (dwfl_report_begin) -/* Report that a module called NAME pans addresses [START, END). +/* Report that a module called NAME spans addresses [START, END). Returns the module handle, either existing or newly allocated, or returns a null pointer for an allocation error. */ Dwfl_Module * @@ -172,10 +172,11 @@ compare_modules (const void *a, const void *b) if (m2 == NULL) return 1; - GElf_Sxword diff = m1->low_addr - m2->low_addr; - if (diff < 0) + /* No signed difference calculation is correct here, since the + terms are unsigned and could be more than INT64_MAX apart. */ + if (m1->low_addr < m2->low_addr) return -1; - if (diff > 0) + if (m1->low_addr > m2->low_addr) return 1; return 0; } |