lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 08 Jan 2013 12:56:32 +0100
From:	Marc Kleine-Budde <mkl@...gutronix.de>
To:	Oliver Hartkopp <oliver.hartkopp@...kswagen.de>
CC:	Linux Netdev List <netdev@...r.kernel.org>,
	Linux CAN List <linux-can@...r.kernel.org>
Subject: Re: [RFC PATCH net-next] can-gw: add a variable limit for CAN frame
 routings

On 01/08/2013 11:26 AM, Oliver Hartkopp wrote:
> Am 08.01.2013 09:40, schrieb Marc Kleine-Budde:
>> On 01/07/2013 10:51 PM, Oliver Hartkopp wrote:
> 
> 
>>>
>>>   static __init int cgw_module_init(void)
>>>   {
>>> -    printk(banner);
>>> +    /* sanitize given module parameter */
>>> +    if (max_hops < 1)
>>> +        max_hops = 1;
>>> +
>>> +    if (max_hops > CAN_GW_MAX_HOPS)
>>> +        max_hops = CAN_GW_MAX_HOPS;
>>
>> You can make use of clamp(val, min, max) here.
>>
> 
> ok.
> 
> I added
> 
>     #include <linux/kernel.h>
> 
> where clamp is defined and reduced the code above to
> 
> clamp_t(unsigned int, max_hops, CAN_GW_MIN_HOPS, CAN_GW_MAX_HOPS);
> 
> Unfortunately clamp(max_hops, CAN_GW_MIN_HOPS, CAN_GW_MAX_HOPS) did not
> work.
> 
> => (warning: comparison of distinct pointer types lacks a cast)

Defines are probably unsinged longs, by default.

> Will send the v2 when there're no other remarks tommorrow.

Marc
-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


Download attachment "signature.asc" of type "application/pgp-signature" (262 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ