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-db1c1cce4a653dcbe6949c72ae7b9f42cab1b929@git.kernel.org>
Date:	Fri, 18 Feb 2011 16:07:20 GMT
From:	tip-bot for Richard Cochran <richardcochran@...il.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...hat.com,
	richardcochran@...il.com, tglx@...utronix.de,
	richard.cochran@...cron.at
Subject: [tip:timers/core] ntp: Remove redundant and incorrect parameter check

Commit-ID:  db1c1cce4a653dcbe6949c72ae7b9f42cab1b929
Gitweb:     http://git.kernel.org/tip/db1c1cce4a653dcbe6949c72ae7b9f42cab1b929
Author:     Richard Cochran <richardcochran@...il.com>
AuthorDate: Fri, 18 Feb 2011 10:07:25 +0100
Committer:  Thomas Gleixner <tglx@...utronix.de>
CommitDate: Fri, 18 Feb 2011 17:01:12 +0100

ntp: Remove redundant and incorrect parameter check

The ADJ_SETOFFSET code redundantly checks the range of the nanoseconds
field of the time value. This field is checked again in the subsequent
call to timekeeping_inject_offset(). Also, as is, the check will not
detect whether the number of microseconds is out of range.

Let timekeeping_inject_offset() do the error checking.
 
Signed-off-by: Richard Cochran <richard.cochran@...cron.at>
Cc: johnstul@...ibm.com
LKML-Reference: <20110218090724.GA2924@...coc20.at.omicron.at>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>

---
 kernel/time/ntp.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 5ac5932..5f1bb8e 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -650,13 +650,13 @@ int do_adjtimex(struct timex *txc)
 
 	if (txc->modes & ADJ_SETOFFSET) {
 		struct timespec delta;
-		if ((unsigned long)txc->time.tv_usec >= NSEC_PER_SEC)
-			return -EINVAL;
 		delta.tv_sec  = txc->time.tv_sec;
 		delta.tv_nsec = txc->time.tv_usec;
 		if (!(txc->modes & ADJ_NANO))
 			delta.tv_nsec *= 1000;
-		timekeeping_inject_offset(&delta);
+		result = timekeeping_inject_offset(&delta);
+		if (result)
+			return result;
 	}
 
 	getnstimeofday(&ts);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ