Skip to content

Commit dbec64b

Browse files
Srinivas-Kandagatlabrgl
authored andcommitted
gpio: wcd934x: Fix shift-out-of-bounds error
bit-mask for pins 0 to 4 is BIT(0) to BIT(4) however we ended up with BIT(n - 1) which is not right, and this was caught by below usban check UBSAN: shift-out-of-bounds in drivers/gpio/gpio-wcd934x.c:34:14 Fixes: 59c3246 ("gpio: wcd934x: Add support to wcd934x gpio controller") Signed-off-by: Srinivas Kandagatla <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent bdbe871 commit dbec64b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpio/gpio-wcd934x.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <linux/slab.h>
88
#include <linux/of_device.h>
99

10-
#define WCD_PIN_MASK(p) BIT(p - 1)
10+
#define WCD_PIN_MASK(p) BIT(p)
1111
#define WCD_REG_DIR_CTL_OFFSET 0x42
1212
#define WCD_REG_VAL_CTL_OFFSET 0x43
1313
#define WCD934X_NPINS 5

0 commit comments

Comments
 (0)