diff mbox series

[2/3] utils: fix UBSAN warning in fls

Message ID 20200501154819.2984-2-michael-dev@fami-braun.de
State Accepted
Delegated to: Pablo Neira
Headers show
Series [1/3] main: fix ASAN -fsanizize=address error | expand

Commit Message

michael-dev May 1, 2020, 3:48 p.m. UTC
../include/utils.h:120:5: runtime error: left shift of 1103101952 by 1 places cannot be represented in type 'int'

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
---
 include/utils.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Pablo Neira Ayuso May 1, 2020, 7:18 p.m. UTC | #1
On Fri, May 01, 2020 at 05:48:17PM +0200, Michael Braun wrote:
> ../include/utils.h:120:5: runtime error: left shift of 1103101952 by 1 places cannot be represented in type 'int'

Also applied, thanks.
diff mbox series

Patch

diff --git a/include/utils.h b/include/utils.h
index 647e8bbe..f45f2513 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -94,7 +94,7 @@ 
  * This is defined the same way as ffs.
  * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
  */
-static inline int fls(int x)
+static inline int fls(uint32_t x)
 {
 	int r = 32;