From: Andrew Lunn <andrew@lunn.ch>
To: Gilad Ben-Yossef <gilad@benyossef.com>
Cc: Gilad Ben-Yossef <giladb@ezchip.com>,
David Miller <davem@davemloft.net>,
Netdev <netdev@vger.kernel.org>,
Florian Fainelli <f.fainelli@gmail.com>,
Guenter Roeck <linux@roeck-us.net>,
Scott Feldman <sfeldma@gmail.com>
Subject: Re: [PATCH net] dsa: fix promiscuity leak on slave dev open error
Date: Sun, 28 Jun 2015 19:09:53 +0200 [thread overview]
Message-ID: <20150628170953.GW9469@lunn.ch> (raw)
In-Reply-To: <CAOtvUMd0iFYDhFQT6CFvYvvTjGCNYRX2i2vqJaXf3m=+2z=_jw@mail.gmail.com>
> 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
next prev parent reply other threads:[~2015-06-28 17:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-25 13:50 [PATCH net] dsa: fix promiscuity leak on slave dev open error giladb
2015-06-26 15:04 ` Andrew Lunn
2015-06-28 13:19 ` Gilad Ben-Yossef
2015-06-28 17:09 ` Andrew Lunn [this message]
2015-06-26 16:40 ` Florian Fainelli
2015-06-28 23:57 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2015-06-25 13:32 Gilad Ben-Yossef
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150628170953.GW9469@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=gilad@benyossef.com \
--cc=giladb@ezchip.com \
--cc=linux@roeck-us.net \
--cc=netdev@vger.kernel.org \
--cc=sfeldma@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).