[PATCH] fs/binfmt_aout.c: Use printk_ratelimit()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: S.Çağlar Onur
Date: Monday, March 17, 2008 - 2:36 am

Use printk_ratelimit() instead of jiffies based arithmetic, suggested by Geert Uytterhoeven

Cc: linux-arch@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>
---
 fs/binfmt_aout.c |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index a1bb224..ba4cddb 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -372,21 +372,17 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
 			 
 		flush_icache_range(text_addr, text_addr+ex.a_text+ex.a_data);
 	} 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) && printk_ratelimit())
 		{
 			printk(KERN_NOTICE "executable not page aligned\n");
-			error_time2 = jiffies;
 		}
 
-		if ((fd_offset & ~PAGE_MASK) != 0 &&
-		    (jiffies-error_time) > 5*HZ)
+		if ((fd_offset & ~PAGE_MASK) != 0 && printk_ratelimit())
 		{
 			printk(KERN_WARNING 
 			       "fd_offset is not page aligned. Please convert program: %s\n",
 			       bprm->file->f_path.dentry->d_name.name);
-			error_time = jiffies;
 		}
 
 		if (!bprm->file->f_op->mmap||((fd_offset & ~PAGE_MASK) != 0)) {
@@ -495,15 +491,13 @@ static int load_aout_library(struct file *file)
 	start_addr =  ex.a_entry & 0xfffff000;
 
 	if ((N_TXTOFF(ex) & ~PAGE_MASK) != 0) {
-		static unsigned long error_time;
 		loff_t pos = N_TXTOFF(ex);
 
-		if ((jiffies-error_time) > 5*HZ)
+		if (printk_ratelimit())
 		{
 			printk(KERN_WARNING 
 			       "N_TXTOFF is not page aligned. Please convert library: %s\n",
 			       file->f_path.dentry->d_name.name);
-			error_time = jiffies;
 		}
 		down_write(&current->mm->mmap_sem);
 		do_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);
-- 
1.5.4.3

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] arch/alpha/kernel/traps.c: Use time_* macros, S.Çağlar Onur, (Mon Mar 17, 2:36 am)
[PATCH] arch/ia64/kernel/: Use time_* macros, S.Çağlar Onur, (Mon Mar 17, 2:36 am)
[PATCH] arch/parisc/kernel/unaligned.c: Use time_* macros, S.Çağlar Onur, (Mon Mar 17, 2:36 am)
[PATCH] drivers/net/arcnet/arcnet.c: Use time_* macros, S.Çağlar Onur, (Mon Mar 17, 2:36 am)
[PATCH] drivers/net/ax88796.c: Use time_* macros, S.Çağlar Onur, (Mon Mar 17, 2:36 am)
[PATCH] net/mac80211/: Use time_* macros, S.Çağlar Onur, (Mon Mar 17, 2:36 am)
[PATCH] drivers/net/tokenring/3c359.c: Use time_* macros, S.Çağlar Onur, (Mon Mar 17, 2:36 am)
[PATCH] drivers/net/wireless/atmel.c: Use time_* macros, S.Çağlar Onur, (Mon Mar 17, 2:36 am)
[PATCH] fs/binfmt_aout.c: Use printk_ratelimit(), S.Çağlar Onur, (Mon Mar 17, 2:36 am)
Re: [PATCH] arch/ia64/kernel/: Use time_* macros, KOSAKI Motohiro, (Mon Mar 17, 2:59 am)
Re: [PATCH] net/mac80211/: Use time_* macros, John W. Linville, (Tue Mar 25, 11:32 am)