[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4AD44CF6.1070801@bfs.de>
Date: Tue, 13 Oct 2009 11:48:38 +0200
From: walter harms <wharms@....de>
To: Kevin Dawson <kevind@....com.au>
Cc: Roel Kluin <roel.kluin@...il.com>, 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()
Kevin Dawson schrieb:
> 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
>
i like this because it prevents a wrap around for stupid ax25_ctl.arg values but will not help when
ax25_ctl.arg * HZ is used later. NTL i think HZ does not need to be constant these days but i am not an
expert on that area.
re,
wh
--
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