* [PATCH 1/1] Pinctrl: Add in zero check
@ 2022-08-16 9:09 Will Shiu
2022-08-25 12:06 ` Linus Walleij
0 siblings, 1 reply; 4+ messages in thread
From: Will Shiu @ 2022-08-16 9:09 UTC (permalink / raw)
To: stanley.chu, linus.walleij, matthias.bgg, linux-gpio,
linux-kernel, Will.Shiu
Cc: wsd_upstream
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] Pinctrl: Add in zero check
2022-08-16 9:09 [PATCH 1/1] Pinctrl: Add in zero check Will Shiu
@ 2022-08-25 12:06 ` Linus Walleij
2022-08-25 12:17 ` Andy Shevchenko
0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2022-08-25 12:06 UTC (permalink / raw)
To: Will Shiu
Cc: stanley.chu, matthias.bgg, linux-gpio, linux-kernel, wsd_upstream
On Tue, Aug 16, 2022 at 11:09 AM Will Shiu <Will.Shiu@mediatek.com> wrote:
> add in check of buffer offset to avoid the exception when input 0 size.
>
> Signed-off-by: Will Shiu <Will.Shiu@mediatek.com>
Looks good to me, patch applied!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] Pinctrl: Add in zero check
2022-08-25 12:06 ` Linus Walleij
@ 2022-08-25 12:17 ` Andy Shevchenko
2022-08-25 12:19 ` Linus Walleij
0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2022-08-25 12:17 UTC (permalink / raw)
To: Linus Walleij
Cc: Will Shiu, stanley.chu, Matthias Brugger,
open list:GPIO SUBSYSTEM, Linux Kernel Mailing List,
Mediatek WSD Upstream
On Thu, Aug 25, 2022 at 3:07 PM Linus Walleij <linus.walleij@linaro.org> wrote:
> On Tue, Aug 16, 2022 at 11:09 AM Will Shiu <Will.Shiu@mediatek.com> wrote:
>
> > add in check of buffer offset to avoid the exception when input 0 size.
> >
> > Signed-off-by: Will Shiu <Will.Shiu@mediatek.com>
>
> Looks good to me, patch applied!
Sorry, but it seems the author didn't pay much attention and didn't
really work on it. What does the < 0 comparison mean here?
I would ask if there is _real_ issue with the code? What is the use
case and why is this check needed?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] Pinctrl: Add in zero check
2022-08-25 12:17 ` Andy Shevchenko
@ 2022-08-25 12:19 ` Linus Walleij
0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2022-08-25 12:19 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Will Shiu, stanley.chu, Matthias Brugger,
open list:GPIO SUBSYSTEM, Linux Kernel Mailing List,
Mediatek WSD Upstream
On Thu, Aug 25, 2022 at 2:18 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Thu, Aug 25, 2022 at 3:07 PM Linus Walleij <linus.walleij@linaro.org> wrote:
> > On Tue, Aug 16, 2022 at 11:09 AM Will Shiu <Will.Shiu@mediatek.com> wrote:
> >
> > > add in check of buffer offset to avoid the exception when input 0 size.
> > >
> > > Signed-off-by: Will Shiu <Will.Shiu@mediatek.com>
> >
> > Looks good to me, patch applied!
>
> Sorry, but it seems the author didn't pay much attention and didn't
> really work on it. What does the < 0 comparison mean here?
>
> I would ask if there is _real_ issue with the code? What is the use
> case and why is this check needed?
Dropped this until Andy's question is answered.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-08-25 12:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-16 9:09 [PATCH 1/1] Pinctrl: Add in zero check Will Shiu
2022-08-25 12:06 ` Linus Walleij
2022-08-25 12:17 ` Andy Shevchenko
2022-08-25 12:19 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®