On Sun, Jun 14, 2020 at 03:39:18PM -0700, Bart Van Assche wrote: > The request_t 'handle' member is 32-bits wide, hence use wrt_reg_dword(). > Change the cast in the wrt_reg_byte() call to make it clear that a > regular pointer is casted to an __iomem pointer. > > Note: 'pkt' points to I/O memory for the qlafx00 adapter family and to > coherent memory for all other adapter families. > > This patch fixes the following Coverity complaint: > > CID 358864 (#1 of 1): Reliance on integer endianness (INCOMPATIBLE_CAST) > incompatible_cast: Pointer &pkt->handle points to an object whose effective > type is unsigned int (32 bits, unsigned) but is dereferenced as a narrower > unsigned short (16 bits, unsigned). This may lead to unexpected results > depending on machine endianness. > > Cc: Nilesh Javali <njavali@xxxxxxxxxxx> > Cc: Quinn Tran <qutran@xxxxxxxxxxx> > Cc: Himanshu Madhani <himanshu.madhani@xxxxxxxxxx> > Cc: Daniel Wagner <dwagner@xxxxxxx> > Cc: Martin Wilck <mwilck@xxxxxxxx> > Cc: Roman Bolshakov <r.bolshakov@xxxxxxxxx> > Fixes: 8ae6d9c7eb10 ("[SCSI] qla2xxx: Enhancements to support ISPFx00.") > Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> Reviewed-by: Daniel Wagner <dwagner@xxxxxxx> > --- > drivers/scsi/qla2xxx/qla_iocb.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c > index 8865c35d3421..7c2ad8c18398 100644 > --- a/drivers/scsi/qla2xxx/qla_iocb.c > +++ b/drivers/scsi/qla2xxx/qla_iocb.c > @@ -2305,8 +2305,8 @@ __qla2x00_alloc_iocbs(struct qla_qpair *qpair, srb_t *sp) > pkt = req->ring_ptr; > memset(pkt, 0, REQUEST_ENTRY_SIZE); > if (IS_QLAFX00(ha)) { > - wrt_reg_byte((void __iomem *)&pkt->entry_count, req_cnt); > - wrt_reg_word((void __iomem *)&pkt->handle, handle); > + wrt_reg_byte((u8 __force __iomem *)&pkt->entry_count, req_cnt); > + wrt_reg_dword((__le32 __force __iomem *)&pkt->handle, handle); Makes me wonder how this ever worked.