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  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]
Date:	Tue, 11 Sep 2012 11:33:09 -0400
From:	Neil Horman <nhorman@...driver.com>
To:	David Laight <David.Laight@...LAB.COM>
Cc:	"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>,
	davem@...emloft.net, john.r.fastabend@...el.com,
	gaofeng@...fujitsu.com, eric.dumazet@...il.com,
	mark.d.rustad@...el.com, lizefan@...wei.com,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] netprio_cgroup: Optimize the priomap copy loop
 slightly

On Tue, Sep 11, 2012 at 12:42:23PM +0100, David Laight wrote:
> > -	for (i = 0;
> > -	     old_priomap && (i < old_priomap->priomap_len);
> > -	     i++)
> > -		new_priomap->priomap[i] = old_priomap->priomap[i];
> > +	if (old_priomap) {
> > +		old_len = old_priomap->priomap_len;
> > +
> > +		for (i = 0; i < old_len; i++)
> > +			new_priomap->priomap[i] = old_priomap->priomap[i];
> > +	}
> 
> Or:
> 	memcpy(new_priomap->priomap, old_priomap->priomap,
> 		old_priomap->priomap_len * sizeof old_priomap->priomap[0]);
> 
> 	David
> 
Yes, the memcpy would be better here.
Neil

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