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
| ||
|
Date: Sun, 4 Sep 2011 17:34:19 +0200 From: Michał Mirosław <mirqus@...il.com> To: David Ward <david.ward@...mit.edu> Cc: netdev@...r.kernel.org, Julian Anastasov <ja@....bg> Subject: Re: [PATCH 2/2] net: Handle different key sizes between address families in flow cache 2011/9/4 David Ward <david.ward@...mit.edu>: > With the conversion of struct flowi to a union of AF-specific structs, some > operations on the flow cache need to account for the exact size of the key. [...] > --- a/include/net/flow.h > +++ b/include/net/flow.h [...] > +typedef unsigned long flow_compare_t; > + > +static inline size_t flowi_size(u16 family) > +{ > + switch (family) { > + case AF_INET: > + BUILD_BUG_ON(sizeof(struct flowi4) % sizeof(flow_compare_t)); > + return sizeof(struct flowi4); > + case AF_INET6: > + BUILD_BUG_ON(sizeof(struct flowi6) % sizeof(flow_compare_t)); > + return sizeof(struct flowi6); > + case AF_DECnet: > + BUILD_BUG_ON(sizeof(struct flowidn) % sizeof(flow_compare_t)); > + return sizeof(struct flowidn); > + } > + return 0; > +} Since most called user (flow_key_compare) uses returned value didided by sizeof(flow_compare_t), you could just return divided value here and save some shift operations by it. Best Regards, Michał Mirosław -- 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