[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1593382.PUxxx0NMeh@vostro.rjw.lan>
Date: Wed, 05 Feb 2014 01:03:29 +0100
From: "Rafael J. Wysocki" <rjw@...ysocki.net>
To: Sebastian Capella <sebastian.capella@...aro.org>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-pm@...r.kernel.org, linaro-kernel@...ts.linaro.org,
patches@...aro.org, Pavel Machek <pavel@....cz>,
Len Brown <len.brown@...el.com>
Subject: Re: [PATCH v7 2/3] trivial: PM / Hibernate: clean up checkpatch in hibernate.c
On Tuesday, February 04, 2014 03:22:22 PM Sebastian Capella wrote:
> Quoting Sebastian Capella (2014-02-04 14:37:33)
> > Quoting Rafael J. Wysocki (2014-02-04 13:36:29)
> > > > static int __init resumedelay_setup(char *str)
> > > > {
> > > > - resume_delay = simple_strtoul(str, NULL, 0);
> > > > + int ret = kstrtoint(str, 0, &resume_delay);
> > > > + /* mask must_check warn; on failure, leaves resume_delay unchanged */
> > > > + (void)ret;
>
> One unintended consequence of this change is that it'll now accept a
> negative integer parameter.
Well, what about using kstrtouint(), then?
> I'll rework this to have the same behavior as before.
>
> BTW, one question, is the __must_check really needed on kstrtoint?
> Wouldn't it be acceptable to rely on kstrtoint to not update resume_delay
> if it's unable to parse an integer out of the string? Couldn't that be
> a sufficient effect without requiring checking the return?
Well, kstrtoint() is used in some security-sensitive places AFAICS, so it
really is better to check its return value in general. The __must_check
reminds people about that.
Thanks!
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists