On Tue, Nov 3, 2015 at 11:03 AM, Nikolay Aleksandrov
<nikolay@xxxxxxxxxxxxxxxxxxx> wrote:
On 11/03/2015 03:55 AM, Jarod Wilson wrote:
[snip]
+#define for_each_netdev_feature(mask_addr, feature) \^
+ int bit; \
+ for_each_set_bit(bit, (unsigned long *)mask_addr, NETDEV_FEATURE_COUNT) \
+ feature = __NETIF_F_BIT(bit);
+
This is broken, it will not work for more than a single feature.
Indeed it is.
This is used as:
for_each_netdev_feature(&upper_disables, feature) {
...
}
which expands to:
int bit;
for_each_set_bit(bit, (unsigned long *)mask_addr, NETDEV_FEATURE_COUNT)
feature = __NETIF_F_BIT(bit);
{
...
}
Note the assignment to "feature" happens outside the {}-delimited block.
And the block is always executed once.