On Thu, Dec 17, 2009 at 04:16:41PM +0200, Daniel Baluta wrote: > On Thu, Dec 17, 2009 at 4:04 PM, Wolfram Sang <[email protected]> wrote: > >> diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h > >> index 3db7767..b70d6f3 100644 > >> --- a/include/linux/can/dev.h > >> +++ b/include/linux/can/dev.h > >> @@ -77,6 +77,16 @@ void can_put_echo_skb(struct sk_buff *skb, struct > >> net_device *dev, > >> void can_get_echo_skb(struct net_device *dev, unsigned int idx); > >> void can_free_echo_skb(struct net_device *dev, unsigned int idx); > >> > >> +static inline int can_validate_skb(struct sk_buff *skb) > >> +{ > >> + struct can_frame *cf = (struct can_frame *)skb->data; > >> + > >> + if (unlikely(skb->len != sizeof(struct can_frame) || cf->can_dlc > > >> 8)) > >> + return 1; > > > > Maybe -Esomething? > > > >> + > >> + return 0; > >> +} > >> + > or perhaps: > return (unlikely(skb->len != sizeof(struct can_frame) || cf->can_dlc > 8)
This is a new ndo_call, so it should follow common patterns IMHO.
That would be pretty much
Returning an int and use -E...
or maybe
Returning a bool, then we can do like you suggested above
But I think it is better using an int here, you never know what other ndo-users
may need. And ndo_validate_addr uses this scheme, too.
Regards,
Wolfram
PS: Just saw that can_validate_skb() is inline. Why is that?
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
signature.asc
Description: Digital signature
_______________________________________________ Socketcan-core mailing list [email protected] https://lists.berlios.de/mailman/listinfo/socketcan-core
