add in check of buffer offset to avoid the exception when input 0 size. Signed-off-by: Will Shiu <Will.Shiu@xxxxxxxxxxxx> --- drivers/pinctrl/pinmux.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c index f94d43b082d9..646dff591b21 100644 --- a/drivers/pinctrl/pinmux.c +++ b/drivers/pinctrl/pinmux.c @@ -689,6 +689,9 @@ static ssize_t pinmux_select(struct file *file, const char __user *user_buf, if (len > PINMUX_SELECT_MAX) return -ENOMEM; + if (len <= 0) + return -EINVAL; + buf = kzalloc(PINMUX_SELECT_MAX, GFP_KERNEL); if (!buf) return -ENOMEM; -- 2.18.0