Re: [PATCH] Fix cpuset sched_relax_domain_level control file

From: Paul Menage
Date: Tue May 06 2008 - 21:42:17 EST


On Tue, May 6, 2008 at 6:38 PM, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Tue, 06 May 2008 18:08:17 -0700 Paul Menage <menage@xxxxxxxxxx> wrote:
>
> > -static int update_relax_domain_level(struct cpuset *cs, char *buf)
> > +static int update_relax_domain_level(struct cpuset *cs, s64 val)
> > {
> > - int val = simple_strtol(buf, NULL, 10);
> > -
> > - if (val < 0)
> > + if ((int)val < 0)
> > val = -1;
> >
>
> Are you sure about the typecast here? If `val' has a value of say
> 0x0000_ffff_ffff_ffff then I assume the casted value will be negative, only
> it wasn't?
>

It seems like the simplest approach - if it's outside the range of a
positive int, set it to -1.

Paul
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/