[PATCH 2/2] xen-tpmfront: Combine two condition checks into one statement in vtpm_send()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux