Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1640079

[PATCH] fs: cifs: transport: Use time_after for time comparison

From Karim Eshapa <karim.eshapa@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] fs: cifs: transport: Use time_after for time comparison
Date 2017-05-12 02:00 +0200
Message-ID <tG69Y-4C8-9@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Use time_after kernel macro for time comparison
that has safety check.

Signed-off-by: Karim Eshapa <karim.eshapa@gmail.com>
---
 fs/cifs/transport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 4d64b5b..a7f5168 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -94,7 +94,7 @@ DeleteMidQEntry(struct mid_q_entry *midEntry)
 	now = jiffies;
 	/* commands taking longer than one second are indications that
 	   something is wrong, unless it is quite a slow link or server */
-	if ((now - midEntry->when_alloc) > HZ) {
+	if (time_after(now, midEntry->when_alloc + HZ)) {
 		if ((cifsFYI & CIFS_TIMER) && (midEntry->command != command)) {
 			pr_debug(" CIFS slow rsp: cmd %d mid %llu",
 			       midEntry->command, midEntry->mid);
-- 
2.7.4

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] fs: cifs: transport: Use time_after for time comparison Karim Eshapa <karim.eshapa@gmail.com> - 2017-05-12 02:00 +0200
  Re: [PATCH] fs: cifs: transport: Use time_after for time comparison Steve French <smfrench@gmail.com> - 2017-05-13 03:20 +0200

csiph-web