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-next>] [day] [month] [year] [list]
Date:   Thu,  4 Apr 2019 05:39:58 +0530
From:   Siddaraju D H <siddarajudh@...il.com>
To:     siddarajudh@...il.com, john.stultz@...aro.org,
        richardcochran@...il.com, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] ptp/ptp_clock.c: Correct input parameter range check

From: Siddaraju DH <siddarajudh@...il.com>

The ealier implementaion used to return EINVAL for -ve adjustments
in the range -1ns to -999999999ns as these -ve numbers will fail the
unsigned comaparison against NSEC_PER_SEC. Since the tv_sec field
will be ZERO in this range, the user will not be able to specify
the signedness of adjustment through the tv_sec field. So, the user
must be allowed to specify the signedness through tv_usec/nsec
field also. All variables that holds usec/nsec in this function
are signed numbers and there is no need for that type cast.

Signed-off-by: Siddaraju DH <siddarajudh@...il.com>
---
 drivers/ptp/ptp_clock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index 79bd102..ee2b35b 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -143,7 +143,7 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct __kernel_timex *tx)
 		if (!(tx->modes & ADJ_NANO))
 			ts.tv_nsec *= 1000;
 
-		if ((unsigned long) ts.tv_nsec >= NSEC_PER_SEC)
+		if (ts.tv_nsec >= NSEC_PER_SEC)
 			return -EINVAL;
 
 		kt = timespec64_to_ktime(ts);
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ