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] [day] [month] [year] [list]
Date:	Thu, 11 Jun 2015 17:20:05 -0700 (PDT)
From:	David Miller <davem@...emloft.net>
To:	sfeldma@...il.com
Cc:	netdev@...r.kernel.org, jiri@...nulli.us,
	makita.toshiaki@....ntt.co.jp, roopa@...ulusnetworks.com,
	jhs@...atatu.com, simon.horman@...ronome.com
Subject: Re: [PATCH net-next] bridge: use either ndo VLAN ops or switchdev
 VLAN ops to install MASTER vlans

From: sfeldma@...il.com
Date: Thu, 11 Jun 2015 12:15:22 -0700

> +static int __vlan_vid_add(struct net_device *dev, struct net_bridge *br,
> +			  u16 vid, u16 flags)
> +{
> +	const struct net_device_ops *ops = dev->netdev_ops;
> +	struct switchdev_obj vlan_obj = {
> +		.id = SWITCHDEV_OBJ_PORT_VLAN,
> +		.u.vlan = {
> +			.flags = flags,
> +			.vid_start = vid,
> +			.vid_end = vid,
> +		},
> +	};
> +	int err;
> +
> +	/* If driver uses VLAN ndo ops, use 8021q to install vid
> +	 * on device, otherwise try switchdev ops to install vid.
> +	 */
> +
> +	if (ops->ndo_vlan_rx_add_vid) {
> +		err = vlan_vid_add(dev, br->vlan_proto, vid);
> +	} else {
> +		err = switchdev_port_obj_add(dev, &vlan_obj);
> +		if (err == -EOPNOTSUPP)
> +			err = 0;
> +	}

I know this looks like nit-picking, but would you please instantiate
the on-stack vlan_obj in the deepest basic block it is used inside
of?  Which here is the else branch.

> +static void __vlan_vid_del(struct net_device *dev, struct net_bridge *br,
> +			   u16 vid)
> +{
> +	const struct net_device_ops *ops = dev->netdev_ops;
> +	struct switchdev_obj vlan_obj = {
> +		.id = SWITCHDEV_OBJ_PORT_VLAN,
> +		.u.vlan = {
> +			.vid_start = vid,
> +			.vid_end = vid,
> +		},
> +	};
> +
> +	/* If driver uses VLAN ndo ops, use 8021q to delete vid
> +	 * on device, otherwise try switchdev ops to delete vid.
> +	 */
> +
> +	if (ops->ndo_vlan_rx_kill_vid)
> +		vlan_vid_del(dev, br->vlan_proto, vid);
> +	else
> +		switchdev_port_obj_del(dev, &vlan_obj);

Likewise.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ