[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4AD3A67B.6070703@cerebellum.kd>
Date: Tue, 13 Oct 2009 08:58:19 +1100
From: Kevin Dawson <kevind@....com.au>
To: Roel Kluin <roel.kluin@...il.com>
CC: wharms@....de, linux-hams@...r.kernel.org,
netdev <netdev@...r.kernel.org>, Joerg Reuter <jreuter@...na.de>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] ax25: unsigned cannot be less than 0 in ax25_ctl_ioctl()
Roel Kluin wrote:
>> tmp_arg=ax25_ctl.arg * HZ;
>>
>> if (arg == 0 || arg > ULONG_MAX )
>> goto einval_put;
>
> I'm not sure, I think this would only work if we made `arg' an
> unsigned long long.
That depends on the possible values of ax25_ctl.arg.
> + if (ax25_ctl.arg * HZ > ULONG_MAX && ax25_ctl.cmd != AX25_KILL)
> + return -EINVAL;
Why the need to change arg before comparing it with a constant? Let the
compiler do the work:
if (ax25_ctl.arg > ULONG_MAX / HZ && ...
Kevin
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists