mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 08:46:46 +00:00
gpio: wcd934x: Fix shift-out-of-bounds error
commitdbec64b11c
upstream. 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:59c3246834
("gpio: wcd934x: Add support to wcd934x gpio controller") Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
56a388a9cc
commit
e0b518a2eb
1 changed files with 1 additions and 1 deletions
|
@ -7,7 +7,7 @@
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
|
|
||||||
#define WCD_PIN_MASK(p) BIT(p - 1)
|
#define WCD_PIN_MASK(p) BIT(p)
|
||||||
#define WCD_REG_DIR_CTL_OFFSET 0x42
|
#define WCD_REG_DIR_CTL_OFFSET 0x42
|
||||||
#define WCD_REG_VAL_CTL_OFFSET 0x43
|
#define WCD_REG_VAL_CTL_OFFSET 0x43
|
||||||
#define WCD934X_NPINS 5
|
#define WCD934X_NPINS 5
|
||||||
|
|
Loading…
Reference in a new issue