Message ID | 20220905201027.0338ebf933cfd767cfa83da3@otheo.eu |
---|---|
State | New |
Headers | show |
Series | elf: Fix hwcaps string size overestimation | expand |
diff --git a/elf/dl-hwcaps.c b/elf/dl-hwcaps.c index 92eb5379..8f11a18f 100644 --- a/elf/dl-hwcaps.c +++ b/elf/dl-hwcaps.c @@ -197,8 +197,8 @@ _dl_important_hwcaps (const char *glibc_hwcaps_prepend, + hwcaps_counts.total_length); /* Count the number of bits set in the masked value. */ - for (n = 0; (~((1ULL << n) - 1) & masked) != 0; ++n) - if ((masked & (1ULL << n)) != 0) + for (uint64_t mm = masked; mm != 0; mm >>= 1) + if ((mm & 1ULL) != 0) ++cnt; /* For TLS enabled builds always add 'tls'. */
Use a simpler way to count the number of bits set in the masked value in _dl_important_hwcaps. Signed-off-by: Javier Pello <devel@otheo.eu> --- elf/dl-hwcaps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)