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]
Date:   Thu,  3 Mar 2022 15:54:39 +0200
From:   hatimmohammed369@...il.com
To:     john.stultz@...aro.org
Cc:     tglx@...utronix.de, sboyd@...nel.org, linux-kernel@...r.kernel.org,
        gregkh@...e.de, Hatim Muhammed <hatimmohammed369@...il.com>
Subject: [PATCH] Staging: Fix coding style issues

From: Hatim Muhammed <hatimmohammed369@...il.com>

Fixed coding style issues reported by scripts/checkpatch.pl
in file kernel/time/time.c

Signed-off-by: Hatim Muhammed <hatimmohammed369@...il.com>
---
 kernel/time/time.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/kernel/time/time.c b/kernel/time/time.c
index 29923b20e0e4..1a96370ad78f 100644
--- a/kernel/time/time.c
+++ b/kernel/time/time.c
@@ -48,7 +48,6 @@
  * programs who obtain this value by using gettimeofday.
  */
 struct timezone sys_tz;
-
 EXPORT_SYMBOL(sys_tz);
 
 #ifdef __ARCH_WANT_SYS_TIME
@@ -64,7 +63,7 @@ SYSCALL_DEFINE1(time, __kernel_old_time_t __user *, tloc)
 	__kernel_old_time_t i = (__kernel_old_time_t)ktime_get_real_seconds();
 
 	if (tloc) {
-		if (put_user(i,tloc))
+		if (put_user(i, tloc))
 			return -EFAULT;
 	}
 	force_successful_syscall_return();
@@ -109,7 +108,7 @@ SYSCALL_DEFINE1(time32, old_time32_t __user *, tloc)
 	i = (old_time32_t)ktime_get_real_seconds();
 
 	if (tloc) {
-		if (put_user(i,tloc))
+		if (put_user(i, tloc))
 			return -EFAULT;
 	}
 	force_successful_syscall_return();
@@ -373,9 +372,9 @@ SYSCALL_DEFINE1(adjtimex_time32, struct old_timex32 __user *, utp)
  */
 unsigned int jiffies_to_msecs(const unsigned long j)
 {
-#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
+#if MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) >= HZ
 	return (MSEC_PER_SEC / HZ) * j;
-#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
+#elif MSEC_PER_SEC && !(HZ % MSEC_PER_SEC) < HZ
 	return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC);
 #else
 # if BITS_PER_LONG == 32
@@ -435,7 +434,8 @@ time64_t mktime64(const unsigned int year0, const unsigned int mon0,
 	unsigned int mon = mon0, year = year0;
 
 	/* 1..12 -> 11,12,1..10 */
-	if (0 >= (int) (mon -= 2)) {
+	mon -= 2;
+	if (0 >= (int) mon) {
 		mon += 12;	/* Puts Feb last since it has leap day */
 		year -= 1;
 	}
@@ -590,7 +590,7 @@ timespec64_to_jiffies(const struct timespec64 *value)
 	u64 sec = value->tv_sec;
 	long nsec = value->tv_nsec + TICK_NSEC - 1;
 
-	if (sec >= MAX_SEC_IN_JIFFIES){
+	if (sec >= MAX_SEC_IN_JIFFIES) {
 		sec = MAX_SEC_IN_JIFFIES;
 		nsec = 0;
 	}
@@ -609,6 +609,7 @@ jiffies_to_timespec64(const unsigned long jiffies, struct timespec64 *value)
 	 * one divide.
 	 */
 	u32 rem;
+
 	value->tv_sec = div_u64_rem((u64)jiffies * TICK_NSEC,
 				    NSEC_PER_SEC, &rem);
 	value->tv_nsec = rem;
@@ -634,7 +635,7 @@ EXPORT_SYMBOL(jiffies_to_clock_t);
 
 unsigned long clock_t_to_jiffies(unsigned long x)
 {
-#if (HZ % USER_HZ)==0
+#if (HZ % USER_HZ) == 0
 	if (x >= ~0UL / (HZ / USER_HZ))
 		return ~0UL;
 	return x * (HZ / USER_HZ);
@@ -679,10 +680,10 @@ u64 nsec_to_clock_t(u64 x)
 	return div_u64(x * USER_HZ / 512, NSEC_PER_SEC / 512);
 #else
 	/*
-         * max relative error 5.7e-8 (1.8s per year) for USER_HZ <= 1024,
-         * overflow after 64.99 years.
-         * exact for HZ=60, 72, 90, 120, 144, 180, 300, 600, 900, ...
-         */
+	 * max relative error 5.7e-8 (1.8s per year) for USER_HZ <= 1024,
+	 * overflow after 64.99 years.
+	 * exact for HZ=60, 72, 90, 120, 144, 180, 300, 600, 900, ...
+	 */
 	return div_u64(x * 9, (9ull * NSEC_PER_SEC + (USER_HZ / 2)) / USER_HZ);
 #endif
 }
@@ -699,7 +700,7 @@ EXPORT_SYMBOL(jiffies64_to_nsecs);
 
 u64 jiffies64_to_msecs(const u64 j)
 {
-#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
+#if  MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) >= HZ
 	return (MSEC_PER_SEC / HZ) * j;
 #else
 	return div_u64(j * HZ_TO_MSEC_NUM, HZ_TO_MSEC_DEN);
-- 
2.35.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ