Re: [PATCH 3/4] qla2xxx: Fix endianness annotations in source files

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

 



On Mon, Mar 02, 2020 at 10:36:05PM -0800, Bart Van Assche wrote:
> On 2020-03-02 10:40, Daniel Wagner wrote:
> > On Sun, Mar 01, 2020 at 07:30:22PM -0800, Bart Van Assche wrote:
> >> Fix all endianness complaints reported by sparse (C=2).
> > 
> > [...]
> > 
> >>  int
> >> -qla24xx_dump_ram(struct qla_hw_data *ha, uint32_t addr, uint32_t *ram,
> >> -    uint32_t ram_dwords, void **nxt)
> >> +qla24xx_dump_ram(struct qla_hw_data *ha, uint32_t addr, __be32 *ram,
> >> +		 uint32_t ram_dwords, void **nxt)
> >>  {
> >>  	int rval = QLA_FUNCTION_FAILED;
> >>  	struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
> >>  	dma_addr_t dump_dma = ha->gid_list_dma;
> >> -	uint32_t *chunk = (void *)ha->gid_list;
> >> +	uint32_t *chunk = (uint32_t *)ha->gid_list;
> >>  	uint32_t dwords = qla2x00_gid_list_size(ha) / 4;
> >>  	uint32_t stat;
> >>  	ulong i, j, timer = 6000000;
> >> @@ -252,9 +252,9 @@ qla24xx_dump_ram(struct qla_hw_data *ha, uint32_t addr, uint32_t *ram,
> >>  			return rval;
> >>  		}
> >>  		for (j = 0; j < dwords; j++) {
> >> -			ram[i + j] =
> >> -			    (IS_QLA27XX(ha) || IS_QLA28XX(ha)) ?
> >> -			    chunk[j] : swab32(chunk[j]);
> >> +			ram[i + j] = (__force __be32)
> >> +				((IS_QLA27XX(ha) || IS_QLA28XX(ha)) ?
> >> +				 chunk[j] : swab32(chunk[j]));
> > 
> > Isn't this assuming the host runs in little endian mode? Because later down...
> 
> My goal was not to change the behavior of the code on x86. Bugs on big
> endian systems can be fixed later on (my guess is that this driver does
> not work reliably on big endian), and searching through the code for
> __force casts probably provides some good starting points.

Got it. I was just a bit confused that you are going through the pain
to fix many endianess problems and than leave these ones out. But you
are right, we should fix them later and trying to avoid introducing
regressions in this big patch.

Thans,
Daniel



[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