Skip to content

Commit

Permalink
Don't try to "validate" a non-existing timeval.
Browse files Browse the repository at this point in the history
settime() with a NULL timeval is silly but legal.

Noticed by Dave Jones <[email protected]>

Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Linus Torvalds committed Jan 31, 2006
1 parent 3ee68c4 commit 951069e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ int do_sys_settimeofday(struct timespec *tv, struct timezone *tz)
static int firsttime = 1;
int error = 0;

if (!timespec_valid(tv))
if (tv && !timespec_valid(tv))
return -EINVAL;

error = security_settime(tv, tz);
Expand Down
4 changes: 2 additions & 2 deletions security/seclvl.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ static int seclvl_capable(struct task_struct *tsk, int cap)
*/
static int seclvl_settime(struct timespec *tv, struct timezone *tz)
{
struct timespec now;
if (seclvl > 1) {
if (tv && seclvl > 1) {
struct timespec now;
now = current_kernel_time();
if (tv->tv_sec < now.tv_sec ||
(tv->tv_sec == now.tv_sec && tv->tv_nsec < now.tv_nsec)) {
Expand Down

0 comments on commit 951069e

Please sign in to comment.