[PATCH 1/1] Pinctrl: Add in zero check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux