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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <MN2PR21MB13755046D790AA59DFA9EB5BCA240@MN2PR21MB1375.namprd21.prod.outlook.com>
Date:   Sun, 29 Dec 2019 01:06:35 +0000
From:   Haiyang Zhang <haiyangz@...rosoft.com>
To:     Stephen Hemminger <stephen@...workplumber.org>
CC:     "sashal@...nel.org" <sashal@...nel.org>,
        "linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        KY Srinivasan <kys@...rosoft.com>,
        Stephen Hemminger <sthemmin@...rosoft.com>,
        "olaf@...fle.de" <olaf@...fle.de>, vkuznets <vkuznets@...hat.com>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH net-next, 1/3] Drivers: hv: vmbus: Add a dev_num variable
 based on channel offer sequence



> -----Original Message-----
> From: Stephen Hemminger <stephen@...workplumber.org>
> Sent: Saturday, December 28, 2019 7:20 PM
> To: Haiyang Zhang <haiyangz@...rosoft.com>
> Cc: sashal@...nel.org; linux-hyperv@...r.kernel.org; netdev@...r.kernel.org;
> KY Srinivasan <kys@...rosoft.com>; Stephen Hemminger
> <sthemmin@...rosoft.com>; olaf@...fle.de; vkuznets
> <vkuznets@...hat.com>; davem@...emloft.net; linux-kernel@...r.kernel.org
> Subject: Re: [PATCH net-next, 1/3] Drivers: hv: vmbus: Add a dev_num variable
> based on channel offer sequence
> 
> On Sat, 28 Dec 2019 15:46:31 -0800
> Haiyang Zhang <haiyangz@...rosoft.com> wrote:
> 
> > +
> > +next:
> > +	found = false;
> > +
> > +	list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {
> > +		if (i == channel->dev_num &&
> > +		    guid_equal(&channel->offermsg.offer.if_type,
> > +			       &newchannel->offermsg.offer.if_type)) {
> > +			found = true;
> > +			break;
> > +		}
> > +	}
> > +
> > +	if (found) {
> > +		i++;
> > +		goto next;
> > +	}
> > +
> 
> Overall, keeping track of dev_num is a good solution.
> 
> I prefer not having a loop coded with goto's. Why not
> a nested loop.
Sure, I can use a nested loop.

> Also, there already is a search of the channel
> list in vmbus_process_offer() so why is another lookup needed?
vmbus_process_offer() looks for the if_instance and if_type matches
to determine if this is a subchannel vs primary channel. The loop 
terminates at different condition from hv_set_devnum().
So I didn't re-use the existing loop.

And this kind of search happens only during channel offering, and
doesn't impact performance much.

Thanks,
- Haiyang


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ