From: Jijie Shao <shaojijie@huawei.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: <shaojijie@huawei.com>, Jakub Kicinski <kuba@kernel.org>,
<davem@davemloft.net>, <edumazet@google.com>, <pabeni@redhat.com>,
<shenjian15@huawei.com>, <wangpeiyang1@huawei.com>,
<liuyonglong@huawei.com>, <sudongming1@huawei.com>,
<xujunsheng@huawei.com>, <shiyongbang@huawei.com>,
<libaihan@huawei.com>, <jdamato@fastly.com>, <horms@kernel.org>,
<jonathan.cameron@huawei.com>,
<shameerali.kolothum.thodi@huawei.com>, <salil.mehta@huawei.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V2 net-next 11/11] net: add is_valid_ether_addr check in dev_set_mac_address
Date: Thu, 22 Aug 2024 15:33:57 +0800 [thread overview]
Message-ID: <2a809cfe-c64c-4fbe-96e5-179d5cd27779@huawei.com> (raw)
In-Reply-To: <5948f3f7-a43c-4238-82ff-2806a5ef5975@lunn.ch>
on 2024/8/21 20:15, Andrew Lunn wrote:
> On Wed, Aug 21, 2024 at 02:04:01PM +0800, Jijie Shao wrote:
>> on 2024/8/21 9:55, Jakub Kicinski wrote:
>>> On Tue, 20 Aug 2024 22:01:54 +0800 Jijie Shao wrote:
>>>> core need test the mac_addr not every driver need to do.
>>>>
>>>> Signed-off-by: Jijie Shao <shaojijie@huawei.com>
>>>> ---
>>>> net/core/dev.c | 2 ++
>>>> 1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/net/core/dev.c b/net/core/dev.c
>>>> index e7260889d4cb..2e19712184bc 100644
>>>> --- a/net/core/dev.c
>>>> +++ b/net/core/dev.c
>>>> @@ -9087,6 +9087,8 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa,
>>>> return -EOPNOTSUPP;
>>>> if (sa->sa_family != dev->type)
>>>> return -EINVAL;
>>>> + if (!is_valid_ether_addr(sa->sa_data))
>>>> + return -EADDRNOTAVAIL;
>>> not every netdev is for an Ethernet device
>> ok, this patch will be removed in v3.
>> and the check will move to hibmcge driver.
> No, you just need to use the correct function to perform the check.
>
> __dev_open() does:
>
> if (ops->ndo_validate_addr)
> ret = ops->ndo_validate_addr(dev);
>
> Andrew
okay, it looks perfect!
Jijie Shao
next prev parent reply other threads:[~2024-08-22 7:34 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-20 14:01 [PATCH V2 net-next 00/11] Add support of HIBMCGE Ethernet Driver Jijie Shao
2024-08-20 14:01 ` [PATCH V2 net-next 01/11] net: hibmcge: Add pci table supported in this module Jijie Shao
2024-08-20 14:01 ` [PATCH V2 net-next 02/11] net: hibmcge: Add read/write registers supported through the bar space Jijie Shao
2024-08-20 14:01 ` [PATCH V2 net-next 03/11] net: hibmcge: Add mdio and hardware configuration supported in this module Jijie Shao
2024-08-20 14:01 ` [PATCH V2 net-next 04/11] net: hibmcge: Add interrupt " Jijie Shao
2024-08-20 14:01 ` [PATCH V2 net-next 05/11] net: hibmcge: Implement some .ndo functions Jijie Shao
2024-08-20 14:01 ` [PATCH V2 net-next 06/11] net: hibmcge: Implement .ndo_start_xmit function Jijie Shao
2024-08-20 14:01 ` [PATCH V2 net-next 07/11] net: hibmcge: Implement rx_poll function to receive packets Jijie Shao
2024-08-20 14:01 ` [PATCH V2 net-next 08/11] net: hibmcge: Implement some ethtool_ops functions Jijie Shao
2024-08-20 14:01 ` [PATCH V2 net-next 09/11] net: hibmcge: Add a Makefile and update Kconfig for hibmcge Jijie Shao
2024-08-21 1:54 ` Jakub Kicinski
2024-08-21 6:00 ` Jijie Shao
2024-08-20 14:01 ` [PATCH V2 net-next 10/11] net: hibmcge: Add maintainer " Jijie Shao
2024-08-20 14:01 ` [PATCH V2 net-next 11/11] net: add is_valid_ether_addr check in dev_set_mac_address Jijie Shao
2024-08-21 1:55 ` Jakub Kicinski
2024-08-21 6:04 ` Jijie Shao
2024-08-21 12:15 ` Andrew Lunn
2024-08-22 7:33 ` Jijie Shao [this message]
2024-08-21 1:55 ` [PATCH V2 net-next 00/11] Add support of HIBMCGE Ethernet Driver Jakub Kicinski
2024-08-21 6:53 ` Jijie Shao
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=2a809cfe-c64c-4fbe-96e5-179d5cd27779@huawei.com \
--to=shaojijie@huawei.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jdamato@fastly.com \
--cc=jonathan.cameron@huawei.com \
--cc=kuba@kernel.org \
--cc=libaihan@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyonglong@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=salil.mehta@huawei.com \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=shenjian15@huawei.com \
--cc=shiyongbang@huawei.com \
--cc=sudongming1@huawei.com \
--cc=wangpeiyang1@huawei.com \
--cc=xujunsheng@huawei.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
all inboxes | Powered by JetHome®