Skip to content

Commit

Permalink
scsi: qla2xxx: Suppress Coverity complaints about dseg_r*
Browse files Browse the repository at this point in the history
Change dseq_rq and dseg_rsp from scalar structure members into
single-element arrays such that Coverity does not complain about the
(*cur_dsd)++ statement in append_dsd64().

Link: https://lore.kernel.org/r/20210320232359.941-5-bvanassche@acm.org
Cc: Quinn Tran <qutran@marvell.com>
Cc: Mike Christie <michael.christie@oracle.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
bvanassche authored and martinkpetersen committed Mar 25, 2021
1 parent 37ce4f3 commit 1760323
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 6 additions & 6 deletions drivers/scsi/qla2xxx/qla_mr.c
Original file line number Diff line number Diff line change
Expand Up @@ -3266,8 +3266,8 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 *pfxiocb)
fx_iocb.req_xfrcnt =
cpu_to_le16(fxio->u.fxiocb.req_len);
put_unaligned_le64(fxio->u.fxiocb.req_dma_handle,
&fx_iocb.dseg_rq.address);
fx_iocb.dseg_rq.length =
&fx_iocb.dseg_rq[0].address);
fx_iocb.dseg_rq[0].length =
cpu_to_le32(fxio->u.fxiocb.req_len);
}

Expand All @@ -3276,8 +3276,8 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 *pfxiocb)
fx_iocb.rsp_xfrcnt =
cpu_to_le16(fxio->u.fxiocb.rsp_len);
put_unaligned_le64(fxio->u.fxiocb.rsp_dma_handle,
&fx_iocb.dseg_rsp.address);
fx_iocb.dseg_rsp.length =
&fx_iocb.dseg_rsp[0].address);
fx_iocb.dseg_rsp[0].length =
cpu_to_le32(fxio->u.fxiocb.rsp_len);
}

Expand Down Expand Up @@ -3314,7 +3314,7 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 *pfxiocb)
cpu_to_le16(bsg_job->request_payload.sg_cnt);
tot_dsds =
bsg_job->request_payload.sg_cnt;
cur_dsd = &fx_iocb.dseg_rq;
cur_dsd = &fx_iocb.dseg_rq[0];
avail_dsds = 1;
for_each_sg(bsg_job->request_payload.sg_list, sg,
tot_dsds, index) {
Expand Down Expand Up @@ -3369,7 +3369,7 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 *pfxiocb)
fx_iocb.rsp_dsdcnt =
cpu_to_le16(bsg_job->reply_payload.sg_cnt);
tot_dsds = bsg_job->reply_payload.sg_cnt;
cur_dsd = &fx_iocb.dseg_rsp;
cur_dsd = &fx_iocb.dseg_rsp[0];
avail_dsds = 1;

for_each_sg(bsg_job->reply_payload.sg_list, sg,
Expand Down
8 changes: 6 additions & 2 deletions drivers/scsi/qla2xxx/qla_mr.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,12 @@ struct fxdisc_entry_fx00 {
uint8_t flags;
uint8_t reserved_1;

struct dsd64 dseg_rq;
struct dsd64 dseg_rsp;
/*
* Use array size 1 below to prevent that Coverity complains about
* the append_dsd64() calls for the two arrays below.
*/
struct dsd64 dseg_rq[1];
struct dsd64 dseg_rsp[1];

__le32 dataword;
__le32 adapid;
Expand Down

0 comments on commit 1760323

Please sign in to comment.