RE: [PATCH 7/7] aacraid: sgraw command support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In these cases, the 'addr' is an u64, so is it necessary to perform this
modification?

I will do a critical analysis of the remaining code in the driver for
any values that are, or have a risk of being on some platforms, a 32 bit
entity and undergo this kind of shift action.

Sincerely -- Mark Salyzyn

-----Original Message-----
From: Arjan van de Ven [mailto:arjan@xxxxxxxxxxxxx] 
Sent: Thursday, August 04, 2005 4:17 AM
To: Mark Haverkamp
Cc: Salyzyn, Mark; linux-scsi; James Bottomley
Subject: Re: [PATCH 7/7] aacraid: sgraw command support

On Wed, 2005-08-03 at 15:39 -0700, Mark Haverkamp wrote:
> +               psg->sg[0].addr[1] = cpu_to_le32((u32)(addr>>32));

this is very risky code; if addr is a 32 bit entity, then this is
undefined behavior (which due to the vagities of x86 asm might get
optimized out entirely). It is a lot safer to do (addr>>16)>>16

gcc will optimize that just fine, the difference is that it's still
defined C behavior regardless of the type of addr.


-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux