mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Christie <michael.christie@oracle.com>
To: Daniil Tatianin <d-tatianin@yandex-team.ru>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
	Lee Duncan <lduncan@suse.com>,
	Nilesh Javali <njavali@marvell.com>, Wu Bo <wubo40@huawei.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	lvc-project@linuxtesting.org, yc-core@yandex-team.ru
Subject: Re: [PATCH v2] scsi/cxgbi/libcxgbi: make sure sg is present before calling sg_next()
Date: Mon, 14 Nov 2022 16:23:58 -0600	[thread overview]
Message-ID: <ca3a88b8-da56-d78d-1c01-6d4b4ea6f8d7@oracle.com> (raw)
In-Reply-To: <20221114150923.3544796-1-d-tatianin@yandex-team.ru>

On 11/14/22 9:09 AM, Daniil Tatianin wrote:
> sg_next() dereferences the passed sg, therefore we have to verify that
> it's present before calling it.
> 
> Found by Linux Verification Center (linuxtesting.org) with the SVACE
> static analysis tool.
> 
> Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
> ---
>  drivers/scsi/cxgbi/libcxgbi.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
> index af281e271f88..2ff9810f42a9 100644
> --- a/drivers/scsi/cxgbi/libcxgbi.c
> +++ b/drivers/scsi/cxgbi/libcxgbi.c
> @@ -1196,8 +1196,7 @@ void cxgbi_ddp_set_one_ppod(struct cxgbi_pagepod *ppod,
>  
>  	if (offset == len) {
>  		offset = 0;
> -		sg = sg_next(sg);
> -		if (sg) {
> +		if (sg && (sg = sg_next(sg))) {
>  			addr = sg_dma_address(sg);
>  			len = sg_dma_len(sg);
>  		}

Is cxgbit_set_one_ppod the same function but it already has the extra
sg check? Should it be a libcxgb function in libcxgb_ppm.c?

       reply	other threads:[~2022-11-14 22:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221114150923.3544796-1-d-tatianin@yandex-team.ru>
2022-11-14 22:23 ` Mike Christie [this message]
     [not found]   ` <84a02b26-392e-994d-bd1f-ecc28231fbfc@yandex-team.ru>
2022-11-15 16:59     ` Mike Christie
     [not found]       ` <20075199-1e6c-28ad-1440-4dc61985d8f4@yandex-team.ru>
2022-11-17 13:30         ` Varun Prakash

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=ca3a88b8-da56-d78d-1c01-6d4b4ea6f8d7@oracle.com \
    --to=michael.christie@oracle.com \
    --cc=d-tatianin@yandex-team.ru \
    --cc=jejb@linux.ibm.com \
    --cc=lduncan@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=martin.petersen@oracle.com \
    --cc=njavali@marvell.com \
    --cc=wubo40@huawei.com \
    --cc=yc-core@yandex-team.ru \
    /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®