From: Lee Duncan <lduncan@suse.com>
To: Bart Van Assche <bvanassche@acm.org>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>
Cc: linux-scsi@vger.kernel.org, Quinn Tran <qutran@marvell.com>,
Mike Christie <michael.christie@oracle.com>,
Daniel Wagner <dwagner@suse.de>,
Himanshu Madhani <himanshu.madhani@oracle.com>
Subject: Re: [PATCH v2 4/6] qla2xxx: Suppress Coverity complaints about dseg_r*
Date: Thu, 18 Mar 2021 09:00:31 -0700 [thread overview]
Message-ID: <b04f8794-caa7-a21a-0c5f-363dd4ea6e43@suse.com> (raw)
In-Reply-To: <20210318032840.7611-5-bvanassche@acm.org>
On 3/17/21 8:28 PM, Bart Van Assche wrote:
> 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().
>
> 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>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/scsi/qla2xxx/qla_mr.c | 12 ++++++------
> drivers/scsi/qla2xxx/qla_mr.h | 4 ++--
> 2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c
> index ca7306685325..61eaf6c4ac47 100644
> --- a/drivers/scsi/qla2xxx/qla_mr.c
> +++ b/drivers/scsi/qla2xxx/qla_mr.c
> @@ -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);
> }
>
> @@ -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);
> }
>
> @@ -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) {
> @@ -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,
> diff --git a/drivers/scsi/qla2xxx/qla_mr.h b/drivers/scsi/qla2xxx/qla_mr.h
> index 73be8348402a..eefbae9d7547 100644
> --- a/drivers/scsi/qla2xxx/qla_mr.h
> +++ b/drivers/scsi/qla2xxx/qla_mr.h
> @@ -176,8 +176,8 @@ struct fxdisc_entry_fx00 {
> uint8_t flags;- &
> uint8_t reserved_1;
>
> - struct dsd64 dseg_rq;
> - struct dsd64 dseg_rsp;
> + struct dsd64 dseg_rq[1];
> + struct dsd64 dseg_rsp[1];
>
> __le32 dataword;
> __le32 adapid;
>
I dislike such an uncommented change just to keep a tool happy. Could
you add a comment in qla_mr.h saying why these are one-element-long
arrays, just so nobody optimizes those out later?
If you do that, please add my:
Reviewed-by: Lee Duncan <lduncan@suse.com>
--
Lee Duncan
next prev parent reply other threads:[~2021-03-18 16:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-18 3:28 [PATCH v2 0/6] qla2xxx patches for kernel v5.12 and v5.13 Bart Van Assche
2021-03-18 3:28 ` [PATCH v2 1/6] Revert "qla2xxx: Make sure that aborted commands are freed" Bart Van Assche
2021-03-18 3:28 ` [PATCH v2 2/6] qla2xxx: Constify struct qla_tgt_func_tmpl Bart Van Assche
2021-03-18 16:01 ` Lee Duncan
2021-03-18 3:28 ` [PATCH v2 3/6] qla2xxx: Fix endianness annotations Bart Van Assche
2021-03-18 16:01 ` Lee Duncan
2021-03-18 3:28 ` [PATCH v2 4/6] qla2xxx: Suppress Coverity complaints about dseg_r* Bart Van Assche
2021-03-18 16:00 ` Lee Duncan [this message]
2021-03-18 19:10 ` Bart Van Assche
2021-03-18 3:28 ` [PATCH v2 5/6] qla2xxx: Simplify qla8044_minidump_process_control() Bart Van Assche
2021-03-18 16:03 ` Lee Duncan
2021-03-18 3:28 ` [PATCH v2 6/6] qla2xxx: Always check the return value of qla24xx_get_isp_stats() Bart Van Assche
2021-03-18 8:08 ` Daniel Wagner
2021-03-18 19:11 ` Bart Van Assche
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b04f8794-caa7-a21a-0c5f-363dd4ea6e43@suse.com \
--to=lduncan@suse.com \
--cc=bvanassche@acm.org \
--cc=dwagner@suse.de \
--cc=himanshu.madhani@oracle.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=michael.christie@oracle.com \
--cc=qutran@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).