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  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 11 Jan 2010 20:13:50 +0100
From:	Marc Kleine-Budde <mkl@...gutronix.de>
To:	Oliver Hartkopp <socketcan@...tkopp.net>
CC:	Wolfgang Grandegger <wg@...ndegger.com>,
	SocketCAN Core Mailing List <socketcan-core@...ts.berlios.de>,
	Linux Netdev List <netdev@...r.kernel.org>,
	David Miller <davem@...emloft.net>
Subject: Re: [PATCH net-next-2.6] can: Unify droping of invalid tx skbs and
 netdev	stats

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Marc Kleine-Budde wrote:
> Oliver Hartkopp wrote:
>> Wolfgang Grandegger wrote:
> 
>>>>  
>>>> +	if (skb->len != sizeof(*cf) || cf->can_dlc > 8) {
>>>> +		kfree_skb(skb);
>>>> +		dev->stats.tx_dropped++;
>>>> +		return NETDEV_TX_OK;
>>>> +	}
>>> A static inline function "invalid_can_skb(skb)" (or "no_can_skb") would
>>> be handy here:
>>>
>>> 	if (invalid_can_skb(skb)) {
>>> 		kfree_skb(skb);
>>> 		dev->stats.tx_dropped++;
>>> 		return NETDEV_TX_OK;		
>>> 	}
>> Another idea could be:
> 
>> 	if (can_dropped_invalid_skb(skb, dev))
>> 		return NETDEV_TX_OK;
> 
>> with
> 
>> static inline int can_dropped_invalid_skb(struct sk_buff *skb, struct net_device *dev)
>> {
>> 	const struct can_frame *cf = (struct can_frame *)skb->data;
> 
>> 	if (unlikely(skb->len != sizeof(*cf) || cf->can_dlc > 8)) {
>> 		kfree_skb(skb);
>> 		dev->stats.tx_dropped++;
>> 		return 1;
>> 	}
> 
>> 	return 0;
>> }
> 
> this functions looks nice, but I'd swap its arguments, in order to have
> the same signature as the alloc_can_skb() functions

I mean...have the struct net device the first argument

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   |
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAktLeG4ACgkQjTAFq1RaXHPhswCfaeUWz6rQzthR02H+AtqF/kXw
UIcAn0LOdZy8UZP61O9vuQgFU21h6atO
=LQ1H
-----END PGP SIGNATURE-----
--
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