From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932351AbdJWNoH (ORCPT ); Mon, 23 Oct 2017 09:44:07 -0400 Received: from mga06.intel.com ([134.134.136.31]:8847 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932210AbdJWNoG (ORCPT ); Mon, 23 Oct 2017 09:44:06 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,423,1503385200"; d="scan'208";a="326564307" Date: Mon, 23 Oct 2017 15:44:01 +0200 From: Jarkko Sakkinen To: SF Markus Elfring Cc: linux-integrity@vger.kernel.org, Jason Gunthorpe , Peter =?iso-8859-1?Q?H=FCwe?= , LKML , kernel-janitors@vger.kernel.org Subject: Re: [PATCH 2/2] xen-tpmfront: Combine two condition checks into one statement in vtpm_send() Message-ID: <20171023134401.n5mx6f6gjfhxtnxu@linux.intel.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 22, 2017 at 01:30:46PM +0200, SF Markus Elfring wrote: > From: Markus Elfring > 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 > --- > 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