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: <52A27BBD.7050203@redhat.com>
Date:	Fri, 06 Dec 2013 20:37:01 -0500
From:	Vlad Yasevich <vyasevic@...hat.com>
To:	Stephen Hemminger <stephen@...workplumber.org>
CC:	Alex Williamson <alex.williamson@...hat.com>,
	Rusty Russell <rusty@...tcorp.com.au>,
	"Michael S. Tsirkin" <mst@...hat.com>, netdev@...r.kernel.org
Subject: Re: [RFC] virtio_net: multicast address list never sent to host

[fixed alex's address to stop bounces]

On 12/06/2013 05:51 PM, Stephen Hemminger wrote:
> On Fri, 06 Dec 2013 09:38:35 -0500
> Vlad Yasevich <vyasevic@...hat.com> wrote:
> 
>>> -		sgs[out_num++] = out;
>>> -	if (in)
>>> -		sgs[out_num + in_num++] = in;
>>> +	while (out_cnt-- > 0)
>>> +		sgs[out_num++] = out++;  
>>
>> I think we can skip sg_count and just use
>>         while ((sg = sg_next(out)) != NULL)
>>                 sgs[out_num++] = sg;
>>
>> And we can probably do this loop for both 'in' and 'out' pointers.
>>
>> -vlad
> 
> 
> That won't work because callers pass a list with a single element,
> as in:

Ok, then how about:

    for (sg = out; sg; sg = sg_next(sg))
         sgs[out_num++] = sg;

    for (sg = in; sg; sg = sg_next(sg))
         sgs[in_num++] = sg;

since even a list of 1 element can be iterated using sg_next().

This makes it generic and will not require this function to change
if we ever had more then 2 elements to set, or even more then 1 element
to receive.

-vlad

>   
>> static int virtnet_set_mac_address(struct net_device *dev, void *p)
>> {
>> 	struct virtnet_info *vi = netdev_priv(dev);
>> 	struct virtio_device *vdev = vi->vdev;
>> 	int ret;
>> 	struct sockaddr *addr = p;
>> 	struct scatterlist sg;
>>
>> 	ret = eth_prepare_mac_addr_change(dev, p);
>> 	if (ret)
>> 		return ret;
>>
>> 	if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR)) {
>> 		sg_init_one(&sg, addr->sa_data, dev->addr_len);
>> 		if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MAC,
>> 					  VIRTIO_NET_CTRL_MAC_ADDR_SET,
>> 					  &sg, NULL)) {
>> 			dev_warn(&vdev->dev,

--
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