[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220816090903.19558-1-Will.Shiu@mediatek.com>
Date: Tue, 16 Aug 2022 17:09:03 +0800
From: Will Shiu <Will.Shiu@...iatek.com>
To: <stanley.chu@...iatek.com>, <linus.walleij@...aro.org>,
<matthias.bgg@...il.com>, <linux-gpio@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <Will.Shiu@...iatek.com>
CC: <wsd_upstream@...iatek.com>
Subject: [PATCH 1/1] Pinctrl: Add in zero check
add in check of buffer offset to avoid the exception when input 0 size.
Signed-off-by: Will Shiu <Will.Shiu@...iatek.com>
---
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
Powered by blists - more mailing lists