Re: [PATCH -next] sh: intc: replace simple_strtoul to kstrtoul
John Paul Adrian Glaubitz <[email protected]>
| Newsgroups | gmane.linux.ports.sh.devel |
|---|---|
| Message-ID | <fe98fdea503e036c8d1e49b354b3921a592febd4.camel@physik.fu-berlin.de> |
Hi Hongbo, On Fri, 2024-08-30 at 16:04 +0800, Hongbo Li wrote: > The function simple_strtoul performs no error checking > in scenarios where the input value overflows the intended > output variable. > > We can replace the use of the simple_strtoul with the safer > alternatives kstrtoul. For fail case, we also print the extra > message. > > Signed-off-by: Hongbo Li <[email protected]> > --- > drivers/sh/intc/userimask.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/sh/intc/userimask.c b/drivers/sh/intc/userimask.c > index abe9091827cd..c9892338fc22 100644 > --- a/drivers/sh/intc/userimask.c > +++ b/drivers/sh/intc/userimask.c > @@ -33,7 +33,8 @@ store_intc_userimask(struct device *dev, > { > unsigned long level; > > - level = simple_strtoul(buf, NULL, 10); > + if (kstrtoul(buf, 10, &level)) > + return -EINVAL; > > /* > * Minimal acceptable IRQ levels are in the 2 - 16 range, but Thanks for your patch. I will try to review it and the other pending patches for sh-linux over the weekend. Adrian -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913