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: Mon, 25 Jan 2010 09:34:52 +0100 From: Jiri Pirko <jpirko@...hat.com> To: David Miller <davem@...emloft.net> Cc: netdev@...r.kernel.org Subject: Re: [PATCH net-next-2.6] net: use helpers to access uc list Mon, Jan 25, 2010 at 08:02:51AM CET, davem@...emloft.net wrote: >From: Jiri Pirko <jpirko@...hat.com> >Date: Sun, 24 Jan 2010 11:42:45 +0100 > >> +#define netdev_uc_count(dev) ((dev)->uc.count) >> + >> +#define netdev_get_list_by_addr(a) \ >> + (container_of((void *) a, struct netdev_hw_addr, addr)->list) >> + >> +#define netdev_get_addr_by_list(l) \ >> + (list_entry(l, struct netdev_hw_addr, list)->addr) >> + >> +#define netdev_for_each_addr(a, head) \ >> + for (a = netdev_get_addr_by_list((head)->next); \ >> + prefetch(netdev_get_list_by_addr(a).next), \ >> + &netdev_get_list_by_addr(a) != (head); \ >> + a = netdev_get_addr_by_list(netdev_get_list_by_addr(a).next)) >> + >> +#define netdev_for_each_uc_addr(a, dev) \ >> + netdev_for_each_addr(a, &dev->uc.list) >> + > >I should have mentioned this the other day, but I don't like >having "unsigned char *" being the type of the element iterator. > >Sure it allows you, I guess, to eliminate one local variable >in the places the iterate, but it definitely is at the cost >of aestetics. > >Please use some normal iterating object for the iterator, such as >"struct list_head *" or "struct netdev_hw_addr *". Probably the >latter would work best. Well I use "unsigned char *" as iterator because it would allow smooth thansition to list_head in case of mc_list. Currently "struct dev_addr_list" is used to store address in the list but in the end "struct netdev_hw_addr *" will be used. To use "struct list_head *" or "struct netdev_hw_addr *" as an iterator it would be needed to convert all drivers at once and that's not doable. Therefore I see "unsigned char *" cursor as the best option. Jirka > -- 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