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]
Date:	Wed, 23 Jul 2008 17:35:18 +0800
From:	Wang Chen <wangchen@...fujitsu.com>
To:	Ingo Oeser <netdev@...eo.de>
CC:	"David S. Miller" <davem@...emloft.net>,
	NETDEV <netdev@...r.kernel.org>
Subject: Re: [PATCH 1/2] ipmr: delete redundant variable

Ingo Oeser said the following on 2008-7-23 16:03:
> Hi Wang Chen,
> 
> Wang Chen schrieb:
>> *v can be removed as this patch showing.
> 
> You are right, but did you check the resulting asm?
>  
>> Signed-off-by: Wang Chen <wangchen@...fujitsu.com>
>> ---
>> diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
>> index c519b8d..6e715c7 100644
>> --- a/net/ipv4/ipmr.c
>> +++ b/net/ipv4/ipmr.c
>> @@ -1129,9 +1128,9 @@ static int ipmr_device_event(struct notifier_block *this, unsigned long event, v
>>  
>>  	if (event != NETDEV_UNREGISTER)
>>  		return NOTIFY_DONE;
>> -	v=&vif_table[0];
>> -	for (ct=0;ct<maxvif;ct++,v++) {
>> -		if (v->dev==dev)
> 
> This is ptr += sizeof(vif_table[0])
> 
>> +
>> +	for (ct = 0; ct < maxvif; ct++) {
>> +		if (vif_table[ct].dev == dev)
> 
> This is ptr + ct * sizeof(vif_table[0])
> 
> On architectures, where the second address variant is
> not supported, it spills a register with the multiply/shift.
> 

But "accessing entry of table by index" is always allowed,
right?
If the complier makes such pointer which spills a register with
the multiply/shift, the simple code as following is bug too:
i = table[100].field;
But it shouldn't, right :)

> But the second variant could be easily auto vectorized, 
> if we had no if.
> 
> So just check the asm on a CISC and a RISC architecture 
> with a cross compile, before you transform these patterns.
> 
> Maybe GCC even transform one into the other these days :-)

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