projects
/
platform
/
upstream
/
bluez.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5b48d86
)
shared/util: Fix undefined behavior of left shift
author
Sonny Sasaka
<sonnysasaka@chromium.org>
Wed, 3 Jun 2020 17:56:00 +0000
(10:56 -0700)
committer
Ayush Garg
<ayush.garg@samsung.com>
Mon, 12 Apr 2021 09:00:49 +0000
(14:30 +0530)
When left-shifting 1, we should be explicit that it is an unsigned 1.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
src/shared/util.c
patch
|
blob
|
history
diff --git
a/src/shared/util.c
b/src/shared/util.c
index
99aa525
..
230f7d3
100755
(executable)
--- a/
src/shared/util.c
+++ b/
src/shared/util.c
@@
-139,7
+139,7
@@
uint8_t util_get_uid(unsigned int *bitmap, uint8_t max)
if (!id || id > max)
return 0;
- *bitmap |= 1 << (id - 1);
+ *bitmap |= 1
u
<< (id - 1);
return id;
}
@@
-150,7
+150,7
@@
void util_clear_uid(unsigned int *bitmap, uint8_t id)
if (!id)
return;
- *bitmap &= ~(1 << (id - 1));
+ *bitmap &= ~(1
u
<< (id - 1));
}
static const struct {