lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <ca3a88b8-da56-d78d-1c01-6d4b4ea6f8d7@oracle.com>
Date:   Mon, 14 Nov 2022 16:23:58 -0600
From:   Mike Christie <michael.christie@...cle.com>
To:     Daniil Tatianin <d-tatianin@...dex-team.ru>,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>
Cc:     "Martin K. Petersen" <martin.petersen@...cle.com>,
        Lee Duncan <lduncan@...e.com>,
        Nilesh Javali <njavali@...vell.com>, Wu Bo <wubo40@...wei.com>,
        linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
        lvc-project@...uxtesting.org, yc-core@...dex-team.ru
Subject: Re: [PATCH v2] scsi/cxgbi/libcxgbi: make sure sg is present before
 calling sg_next()

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@...dex-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?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ