From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arjan van de Ven Subject: Re: fix corruption in qla1280 Date: Mon, 14 Jul 2003 21:01:48 +0000 Sender: linux-scsi-owner@vger.kernel.org Message-ID: <20030714210148.B32473@devserv.devel.redhat.com> References: <20030714092437.A4100@devserv.devel.redhat.com> <20030714204315.GL6108@nbkurt.garloff.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from nat-pool-rdu.redhat.com ([66.187.233.200]:8802 "EHLO devserv.devel.redhat.com") by vger.kernel.org with ESMTP id S270871AbTGNUrD (ORCPT ); Mon, 14 Jul 2003 16:47:03 -0400 Content-Disposition: inline In-Reply-To: <20030714204315.GL6108@nbkurt.garloff.de>; from garloff@suse.de on Mon, Jul 14, 2003 at 10:43:15PM +0200 List-Id: linux-scsi@vger.kernel.org To: Kurt Garloff , Arjan van de Ven , akpm@osdl.org, linux-scsi@vger.kernel.org On Mon, Jul 14, 2003 at 10:43:15PM +0200, Kurt Garloff wrote: > Arjan, > > On Mon, Jul 14, 2003 at 09:24:37AM +0000, Arjan van de Ven wrote: > > In C, doing >> 32 on a 32 bit wide variable is undefined behavior, and the > > code that gets generated by gcc (using the cpu shr) effectively means that > > it's a nop. The patch below to qla1280.c fixes such a case, doing > > >>16 twice looks more expensive but gcc optimizes it out while keeping > > correct behavior. > > If it's really a 32 bit variable, > #define pci_dma_hi32(a) (0) > would be correct. Shifting a 32bit value 32times to the right is just 0. > What do I miss? it's only a 32 bit variable on 32 bit platforms (or rather, when dma_addr_t is 32 bit.. the ifdefs for that get evil)