lkml.org 
[lkml]   [2022]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/1] Pinctrl: Add in zero check
Date
add in check of buffer offset to avoid the exception when input 0 size.

Signed-off-by: Will Shiu <Will.Shiu@mediatek.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
\
 
 \ /
  Last update: 2022-08-16 11:41    [W:0.051 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site