udev_device.c: fix integer overflow
Bitwise AND operation can produce value that may be larger than test_bit() return value. Convert result to bool using `!!` to avoid integer overflow. Fixes: #33
This commit is contained in:
parent
bd7d1803e6
commit
bf23c9e5ba
1 changed files with 1 additions and 1 deletions
|
|
@ -389,7 +389,7 @@ static void make_bit(unsigned long *arr, int cnt, const char *str)
|
||||||
|
|
||||||
static int test_bit(unsigned long *arr, unsigned long bit)
|
static int test_bit(unsigned long *arr, unsigned long bit)
|
||||||
{
|
{
|
||||||
return arr[BIT_WORD(bit)] & BIT_MASK(bit);
|
return !!(arr[BIT_WORD(bit)] & BIT_MASK(bit));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_properties_from_evdev(struct udev_device *udev_device)
|
static void set_properties_from_evdev(struct udev_device *udev_device)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue