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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171023134401.n5mx6f6gjfhxtnxu@linux.intel.com>
Date:   Mon, 23 Oct 2017 15:44:01 +0200
From:   Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
To:     SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc:     linux-integrity@...r.kernel.org,
        Jason Gunthorpe <jgunthorpe@...idianresearch.com>,
        Peter Hüwe <PeterHuewe@....de>,
        LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 2/2] xen-tpmfront: Combine two condition checks into one
 statement in vtpm_send()

On Sun, Oct 22, 2017 at 01:30:46PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Sun, 22 Oct 2017 13:15:16 +0200
> 
> A return was performed with the same error code after two condition checks.
> Thus use a single statement instead.
> 
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
>  drivers/char/tpm/xen-tpmfront.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/char/tpm/xen-tpmfront.c b/drivers/char/tpm/xen-tpmfront.c
> index 873a5631937a..0d02743e7a87 100644
> --- a/drivers/char/tpm/xen-tpmfront.c
> +++ b/drivers/char/tpm/xen-tpmfront.c
> @@ -82,10 +82,7 @@ static int vtpm_send(struct tpm_chip *chip, u8 *buf, size_t count)
>  	u32 ordinal;
>  	unsigned long duration;
>  
> -	if (offset > PAGE_SIZE)
> -		return -EINVAL;
> -
> -	if (offset + count > PAGE_SIZE)
> +	if (offset > PAGE_SIZE || offset + count > PAGE_SIZE)
>  		return -EINVAL;
>  
>  	/* Wait for completion of any existing command or cancellation */
> -- 
> 2.14.2
> 

This is fine.

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>

/Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ