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]
Message-Id: <1334048547-2983-1-git-send-email-sasikanth.v19@gmail.com>
Date:	Tue, 10 Apr 2012 14:32:27 +0530
From:	Sasikantha babu <sasikanth.v19@...il.com>
To:	Paul Gortmaker <paul.gortmaker@...driver.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...e.hu>
Cc:	linux-kernel@...r.kernel.org,
	Sasikantha babu <sasikanth.v19@...il.com>
Subject: [PATCH] Removed less than zero check, since Schedule_timeout return value is guaranteed to be non-negative

validating timeout against negiatve value is not required, schedule_timeout always returns >= 0.

If someone passes timeout as negative value, Instead of simply returning -ETIME we have to warn them (schedule_timeout 
is already doing it by dumping stack and priniting an error message) about it. 

We must return -ETIME on timer expiry not for invaild timeouts.

Signed-off-by: Sasikantha babu <sasikanth.v19@...il.com>
---
 kernel/semaphore.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/semaphore.c b/kernel/semaphore.c
index 60636a4..029c05b 100644
--- a/kernel/semaphore.c
+++ b/kernel/semaphore.c
@@ -214,7 +214,7 @@ static inline int __sched __down_common(struct semaphore *sem, long state,
 	for (;;) {
 		if (signal_pending_state(state, task))
 			goto interrupted;
-		if (timeout <= 0)
+		if (!timeout)
 			goto timed_out;
 		__set_task_state(task, state);
 		raw_spin_unlock_irq(&sem->lock);
-- 
1.7.3.4

--
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