From: "S.Çağlar Onur" <caglar@pardus.org.tr>
To: linux-kernel@vger.kernel.org
Cc: linux-arch@vger.kernel.org, "S.Çağlar Onur" <caglar@pardus.org.tr>
Subject: [PATCH 12/14] fs/binfmt_aout.c: Use time_* macros
Date: Thu, 14 Feb 2008 17:36:50 +0200 [thread overview]
Message-ID: <1203003412-11594-13-git-send-email-caglar@pardus.org.tr> (raw)
In-Reply-To: y
The functions time_before, time_before_eq, time_after, and time_after_eq are more robust for comparing jiffies against other values.
So following patch implements usage of the time_after() macro, defined at linux/jiffies.h, which deals with wrapping correctly
Cc: linux-arch@vger.kernel.org
Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>
---
fs/binfmt_aout.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index a1bb224..72757fe 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -6,6 +6,7 @@
#include <linux/module.h>
+#include <linux/jiffies.h>
#include <linux/time.h>
#include <linux/kernel.h>
#include <linux/mm.h>
@@ -374,14 +375,14 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
} else {
static unsigned long error_time, error_time2;
if ((ex.a_text & 0xfff || ex.a_data & 0xfff) &&
- (N_MAGIC(ex) != NMAGIC) && (jiffies-error_time2) > 5*HZ)
+ (N_MAGIC(ex) != NMAGIC) && time_after(jiffies, error_time2 + 5 * HZ))
{
printk(KERN_NOTICE "executable not page aligned\n");
error_time2 = jiffies;
}
if ((fd_offset & ~PAGE_MASK) != 0 &&
- (jiffies-error_time) > 5*HZ)
+ time_after(jiffies, error_time + 5 * HZ))
{
printk(KERN_WARNING
"fd_offset is not page aligned. Please convert program: %s\n",
@@ -498,7 +499,7 @@ static int load_aout_library(struct file *file)
static unsigned long error_time;
loff_t pos = N_TXTOFF(ex);
- if ((jiffies-error_time) > 5*HZ)
+ if (time_after(jiffies ,error_time + 5 * HZ))
{
printk(KERN_WARNING
"N_TXTOFF is not page aligned. Please convert library: %s\n",
--
1.5.3.7
next reply other threads:[~2008-02-14 15:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-14 15:36 S.Çağlar Onur [this message]
2008-02-14 19:46 ` [PATCH 12/14] fs/binfmt_aout.c: Use time_* macros Geert Uytterhoeven
2008-02-15 1:19 ` S.Çağlar Onur
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1203003412-11594-13-git-send-email-caglar@pardus.org.tr \
--to=caglar@pardus.org.tr \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox