Google
  Web www.spinics.net

Re: [PATCH] ax25: unsigned cannot be less than 0 in ax25_ctl_ioctl()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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 linux-hams" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Site Home]     [Linux Newbie]     [Kernel Newbies]     [Memory]     [Git]     [Security]     [Netfilter]     [Linux Admin]     [Bugtraq]     [Rubini]     [Photo]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [ARM Linux Kernel]     [Linux Networking]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linux Resources]


Add to Google Powered by Linux