elf: Fix incorrect comparison in sort_priorities_by_name
Commit Message
Reported-By: Stefan Liebler <stli@linux.ibm.com>
---
elf/dl-hwcaps.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Wed, Dec 9, 2020 at 10:24 AM Florian Weimer via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> Reported-By: Stefan Liebler <stli@linux.ibm.com>
>
> ---
> elf/dl-hwcaps.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/elf/dl-hwcaps.c b/elf/dl-hwcaps.c
> index 5a71f80154..000e3c0eb9 100644
> --- a/elf/dl-hwcaps.c
> +++ b/elf/dl-hwcaps.c
> @@ -153,7 +153,7 @@ sort_priorities_by_name (void)
> else
> to_compare = previous->name_length;
> int cmp = memcmp (current->name, previous->name, to_compare);
> - if (cmp >= 0
> + if (cmp > 0
> || (cmp == 0 && current->name_length >= previous->name_length))
> break;
>
>
LGTM.
@@ -153,7 +153,7 @@ sort_priorities_by_name (void)
else
to_compare = previous->name_length;
int cmp = memcmp (current->name, previous->name, to_compare);
- if (cmp >= 0
+ if (cmp > 0
|| (cmp == 0 && current->name_length >= previous->name_length))
break;