Re: [PATCH] [SCSI] aacraid: Fix invalid bit shifts of DMA address

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

 



On Feb 15, 2013, at 9:50 AM, Ben Hutchings <ben@xxxxxxxxxxxxxxx> wrote:

> Commit b5f1758f221e ('[SCSI] aacraid: Fix endian issues in core and
> SRC portions of driver') changed the type of the address variable in
> aac_src_deliver_message() from u64 to dma_addr_t.  In configurations
> with 32-bit dma_addr_t, this results in:
> 
> drivers/scsi/aacraid/src.c: In function 'aac_src_deliver_message':
> drivers/scsi/aacraid/src.c:410:3: warning: right shift count >= width of type [enabled by default]
> drivers/scsi/aacraid/src.c:434:2: warning: right shift count >= width of type [enabled by default]
> 
> Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
> Cc: stable <stable@xxxxxxxxxxxxxxx> # v3.6+
> ---
> This is compile-tested only.

Still works for me. It would be nice to alleviate the BUG_ON when sizeof(dma_addr_t) == 4. I'm wondering, since this driver sets DMA_BIT_MASK correctly, if this check is even needed.

> Ben.
> 
> drivers/scsi/aacraid/src.c |    4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
> index 3b021ec..129b984 100644
> --- a/drivers/scsi/aacraid/src.c
> +++ b/drivers/scsi/aacraid/src.c
> @@ -407,7 +407,7 @@ static int aac_src_deliver_message(struct fib *fib)
> 		fib->hw_fib_va->header.StructType = FIB_MAGIC2;
> 		fib->hw_fib_va->header.SenderFibAddress = (u32)address;
> 		fib->hw_fib_va->header.u.TimeStamp = 0;
> -		BUG_ON((u32)(address >> 32) != 0L);
> +		BUG_ON((u64)address >> 32);
> 		address |= fibsize;
> 	} else {
> 		/* Calculate the amount to the fibsize bits */
> @@ -431,7 +431,7 @@ static int aac_src_deliver_message(struct fib *fib)
> 		address |= fibsize;
> 	}
> 
> -	src_writel(dev, MUnit.IQ_H, (address >> 32) & 0xffffffff);
> +	src_writel(dev, MUnit.IQ_H, (u64)address >> 32);
> 	src_writel(dev, MUnit.IQ_L, address & 0xffffffff);
> 
> 	return 0;
> 

--
Servergy  : http://www.servergy.com/
SwissDisk : http://www.swissdisk.com/
Ubuntu    : http://www.ubuntu.com/
My Blog   : http://ben-collins.blogspot.com/

--
To unsubscribe from this list: 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