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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACLfguVHKw-ppXeA8DDH0CtvYZ9m8rkk+Jr7ZF9pFfbLr1VRGQ@mail.gmail.com>
Date: Tue, 30 Jul 2024 09:27:50 +0800
From: Cindy Lu <lulu@...hat.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: dtatulea@...dia.com, mst@...hat.com, jasowang@...hat.com, parav@...dia.com, 
	sgarzare@...hat.com, netdev@...r.kernel.org, 
	virtualization@...ts.linux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 1/3] vdpa: support set mac address from vdpa tool

On Tue, 30 Jul 2024 at 03:13, Andrew Lunn <andrew@...n.ch> wrote:
>
> > +static int vdpa_dev_net_device_attr_set(struct vdpa_device *vdev,
> > +                                     struct genl_info *info)
> > +{
> > +     struct vdpa_dev_set_config set_config = {};
> > +     struct vdpa_mgmt_dev *mdev = vdev->mdev;
> > +     struct nlattr **nl_attrs = info->attrs;
> > +     const u8 *macaddr;
> > +     int err = -EINVAL;
> > +
> > +     down_write(&vdev->cf_lock);
> > +     if (nl_attrs[VDPA_ATTR_DEV_NET_CFG_MACADDR]) {
> > +             set_config.mask |= BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MACADDR);
> > +             macaddr = nla_data(nl_attrs[VDPA_ATTR_DEV_NET_CFG_MACADDR]);
> > +
> > +             if (is_valid_ether_addr(macaddr)) {
> > +                     ether_addr_copy(set_config.net.mac, macaddr);
> > +                     memcpy(set_config.net.mac, macaddr, ETH_ALEN);
>
> ether_addr_copy() and memcpy()?
>
> > +                     if (mdev->ops->dev_set_attr) {
> > +                             err = mdev->ops->dev_set_attr(mdev, vdev,
> > +                                                           &set_config);
> > +                     } else {
> > +                             NL_SET_ERR_MSG_FMT_MOD(info->extack,
> > +                                                    "device does not support changing the MAC address");
>
> You would generally return EOPNOTSUPP in this case, not EINVAL.
>
> Also, the device does not support setting attributes. Given the
> generic name, i assume you plan to set other attributes in the future,
> at which point this error message will be wrong.
>
sureļ¼Œ will fix this
Thanks
cindy
>         Andrew
>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ