From: James Smart <james.smart@broadcom.com>
To: Colin King <colin.king@canonical.com>,
Dick Kennedy <dick.kennedy@broadcom.com>,
"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
linux-scsi@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: lpfc: sanity check hrq is null before dereferencing it
Date: Sat, 4 Mar 2017 09:42:38 -0800 [thread overview]
Message-ID: <d84cd90f-9252-2329-9f36-c5c461a80290@broadcom.com> (raw)
In-Reply-To: <20170224135642.5690-1-colin.king@canonical.com>
Looks good. I included it in the lpfc patch set just posted.
-- james
On 2/24/2017 5:56 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The sanity check for hrq should be moved to before the deference
> of hrq to ensure we don't perform a null pointer deference.
>
> Detected by CoverityScan, CID#1411650 ("Dereference before null check")
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/scsi/lpfc/lpfc_sli.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
> index e43e5e2..1fba5dc 100644
> --- a/drivers/scsi/lpfc/lpfc_sli.c
> +++ b/drivers/scsi/lpfc/lpfc_sli.c
> @@ -15185,17 +15185,17 @@ lpfc_mrq_create(struct lpfc_hba *phba, struct lpfc_queue **hrqp,
> drq = drqp[idx];
> cq = cqp[idx];
>
> - if (hrq->entry_count != drq->entry_count) {
> - status = -EINVAL;
> - goto out;
> - }
> -
> /* sanity check on queue memory */
> if (!hrq || !drq || !cq) {
> status = -ENODEV;
> goto out;
> }
>
> + if (hrq->entry_count != drq->entry_count) {
> + status = -EINVAL;
> + goto out;
> + }
> +
> if (idx == 0) {
> bf_set(lpfc_mbx_rq_create_num_pages,
> &rq_create->u.request,
prev parent reply other threads:[~2017-03-04 17:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-24 13:56 Colin King
2017-03-04 17:42 ` James Smart [this message]
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=d84cd90f-9252-2329-9f36-c5c461a80290@broadcom.com \
--to=james.smart@broadcom.com \
--cc=colin.king@canonical.com \
--cc=dick.kennedy@broadcom.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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
all inboxes | Powered by JetHome®