[lm-sensors] [resend] [PATCH v2] ibmaem: New driver for power/energy meters in IBM System X hardware

Andrew Morton akpm at linux-foundation.org
Wed May 7 08:11:14 CEST 2008


On Wed, 7 May 2008 08:01:05 +0200 Jean Delvare <khali at linux-fr.org> wrote:

> On Tue, 6 May 2008 17:36:07 -0700, Andrew Morton wrote:
> > A checkpatch version which you might not have says
> > 
> > WARNING: consider using strict_strtol in preference to simple_strtol
> > #1015: FILE: drivers/hwmon/ibmaem.c:918:
> > +       int temp = simple_strtol(buf, NULL, 10); \
> > 
> > total: 0 errors, 1 warnings, 1221 lines checked
> > 
> > because the code as you have it will accept input of the form "12foo". 
> > strict_strtol() will error on that.
> 
> As a side note, I really wonder why this new function wasn't named just
> strtol(), especially if the general idea is to get rid of the "simple"
> variant after some time.

didn't think of doing that.

But:

y:/home/akpm> cat t.c
#include <stdlib.h>
#include <stdio.h>

main()
{
        unsigned long u = strtoul("12foo", 0, 10);
        printf("%lu\n", u);
}
y:/home/akpm> gcc t.c
y:/home/akpm> ./a.out
12


strtoul() has different behaviour.




More information about the lm-sensors mailing list