Thread (6 messages) 6 messages, 5 authors, 2015-06-28

Re: [PATCH net] dsa: fix promiscuity leak on slave dev open error

From: Andrew Lunn <andrew@lunn.ch>
Date: 2015-06-28 17:16:00

It has occurred to me that dev_set_promiscuity() and its brethren
dev_set_allmulti() may not be the best of interfaces:

- On cursory inspection of code using these function their name
implies the value of the relevant counter is set to the value passed
as parameter, not incremented by it.
- No caller I've managed to spot passes anything but -1 or 1

It seems an interface of

int dev_set_promiscuity(struct net_device *dev, bool on);

int dev_set_allmulti(struct net_device *dev, bool on);
on suggests it is an absolute, when in fact you are passing an
increment, so i don't think it is much of an improvement.

Adding #define, PROMISC_INC and PROMISC_DEC might be clearer, and
since this is not a fast path, you could consider parameter
validation. Or dev_get_promiscuity(), det_put_promiscuity().
 
would be as functional (for current users), more readable and less
error prone but I am not sure such a tiny problem (if you can call
this a problem) is worth the churn...
There was only one instance of it wrong, so it is not a very big
problem. I would say it is not worth the churn.

	 Andrew
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help