ubsan: fix undefined shifts

A signed integer cannot be shifted in a way that will flip the
sign bit; make such arguments unsigned to be safe

Change-Id: Iafc060f98f899ae3ffb876ba22fdd6183fbb6e57
This commit is contained in:
Dominique Martinet
2018-12-26 15:06:32 +09:00
parent d9b2924249
commit bc2a444828
3 changed files with 4 additions and 4 deletions

View File

@ -2,7 +2,7 @@
#ifndef INCLUDE_BITOPS_FLS_H
#define INCLUDE_BITOPS_FLS_H
static inline int fls(int x)
static inline int fls(unsigned int x)
{
int r = 32;
if (!x) {