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: <tip-3f1d472055bbe914c9e54715fdbf2272851e23ff@git.kernel.org>
Date:   Tue, 20 Jun 2017 12:38:17 -0700
From:   tip-bot for Mariusz Skamra <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     mariuszx.skamra@...el.com, hpa@...or.com, tglx@...utronix.de,
        linux-kernel@...r.kernel.org, sathyanarayanan.kuppuswamy@...el.com,
        mingo@...nel.org
Subject: [tip:timers/core] ktime: Simplify ktime_compare implementation

Commit-ID:  3f1d472055bbe914c9e54715fdbf2272851e23ff
Gitweb:     http://git.kernel.org/tip/3f1d472055bbe914c9e54715fdbf2272851e23ff
Author:     Mariusz Skamra <mariuszx.skamra@...el.com>
AuthorDate: Fri, 26 May 2017 15:00:47 +0200
Committer:  Thomas Gleixner <tglx@...utronix.de>
CommitDate: Tue, 20 Jun 2017 21:33:55 +0200

ktime: Simplify ktime_compare implementation

ktime_sub can be used here instread of two conditional checks.

Signed-off-by: Mariusz Skamra <mariuszx.skamra@...el.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Acked-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...el.com>
Link: http://lkml.kernel.org/r/1495803647-9504-1-git-send-email-mariuszx.skamra@intel.com

---
 include/linux/ktime.h | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 0c8bd45..04817b1 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -108,11 +108,7 @@ static inline ktime_t timeval_to_ktime(struct timeval tv)
  */
 static inline int ktime_compare(const ktime_t cmp1, const ktime_t cmp2)
 {
-	if (cmp1 < cmp2)
-		return -1;
-	if (cmp1 > cmp2)
-		return 1;
-	return 0;
+	return ktime_sub(cmp1, cmp2);
 }
 
 /**

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ