From: Ulrich Drepper Date: Fri, 29 Dec 2006 20:36:38 +0000 (+0000) Subject: Correct result for whole address range in compare_modules. X-Git-Tag: elfutils-0.125~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a33c3013e80383342825c1af7fad2a6f3979ceee;p=thirdparty%2Felfutils.git Correct result for whole address range in compare_modules. --- diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index f70c3397f..50e9e1bb9 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,9 @@ +2006-12-29 Ulrich Drepper + + * dwfl_module.c (compare_modules): Do not try to be smart and use + subtraction which can lead to wrong results. + Patch by Frank Eigler . + 2006-10-30 Roland McGrath * dwfl_module.c (dwfl_report_module): Comment typo fix. diff --git a/libdwfl/dwfl_module.c b/libdwfl/dwfl_module.c index 5990b7550..0cccb5c09 100644 --- a/libdwfl/dwfl_module.c +++ b/libdwfl/dwfl_module.c @@ -172,10 +172,9 @@ 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) + if (m1->low_addr < m2->low_addr return -1; - if (diff > 0) + if (m1->low_addr > m2->low_addr) return 1; return 0; }