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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080515234114.GA656@toroid.org>
Date:	Fri, 16 May 2008 05:11:14 +0530
From:	Abhijit Menon-Sen <ams@...oid.org>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: [PATCH] Add a void * alternative to print_fn_descriptor_symbol()

At 2008-05-15 14:45:54 -0700, akpm@...ux-foundation.org wrote:
>
> > Would somebody please want to move that cast into the macro (or
> > better yet, make it an inline function that takes a 'void *'),
> > and remove all the casts from the callers?
> 
> Would be nice.

Something like this?

-- ams

All the callers of print_fn_descriptor_symbol() had to cast their void *
argument to unsigned long. This patch adds an inline print_fn_symbolic()
that takes a void * directly, and updates the callers to use it instead.

Signed-off-by: Abhijit Menon-Sen <ams@...oid.org>
---
 include/linux/kallsyms.h  |   10 ++++++++++
 drivers/base/power/main.c |    2 +-
 drivers/pci/quirks.c      |    3 +--
 drivers/pnp/quirks.c      |    3 +--
 init/main.c               |    9 +++------
 5 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 82de2fb..ed8ab42 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -101,6 +101,16 @@ static inline void print_symbol(const char *fmt, unsigned long addr)
 		       __builtin_extract_return_addr((void *)addr));
 }
 
+static inline void print_fn_symbolic(const char *fmt, const void *addr)
+{
+#if defined(CONFIG_IA64) || defined(CONFIG_PPC64)
+	unsigned long *faddr = (unsigned long *)addr;
+	print_symbol(fmt, faddr[0]);
+#else
+	print_symbol(fmt, (unsigned long)addr);
+#endif
+}
+
 #ifndef CONFIG_64BIT
 #define print_ip_sym(ip)		\
 do {					\

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 7b76fd3..9625317 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -418,7 +418,7 @@ void __suspend_report_result(const char *function, void *fn, int ret)
 {
 	if (ret) {
 		printk(KERN_ERR "%s(): ", function);
-		print_fn_descriptor_symbol("%s() returns ", (unsigned long)fn);
+		print_fn_symbolic("%s returns ", fn);
 		printk("%d\n", ret);
 	}
 }

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index f2d9c77..12d07eb 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1503,8 +1503,7 @@ static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_f
  		    (f->device == dev->device || f->device == (u16) PCI_ANY_ID)) {
 #ifdef DEBUG
 			dev_dbg(&dev->dev, "calling ");
-			print_fn_descriptor_symbol("%s()\n",
-				(unsigned long) f->hook);
+			print_fn_symbolic("%s\n", f->hook);
 #endif
 			f->hook(dev);
 		}

diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index ffdb12a..f84d79f 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -331,8 +331,7 @@ void pnp_fixup_device(struct pnp_dev *dev)
 			continue;
 #ifdef DEBUG
 		dev_dbg(&dev->dev, "%s: calling ", f->id);
-		print_fn_descriptor_symbol("%s\n",
-				(unsigned long) f->quirk_function);
+		print_fn_symbolic("%s\n", f->quirk_function);
 #endif
 		f->quirk_function(dev);
 	}

diff --git a/init/main.c b/init/main.c
index f406fef..c456ca8 100644
--- a/init/main.c
+++ b/init/main.c
@@ -706,8 +706,7 @@ static void __init do_initcalls(void)
 		int result;
 
 		if (initcall_debug) {
-			print_fn_descriptor_symbol("calling  %s()\n",
-					(unsigned long) *call);
+			print_fn_symbolic("calling %s\n", *call);
 			t0 = ktime_get();
 		}
 
@@ -717,8 +716,7 @@ static void __init do_initcalls(void)
 			t1 = ktime_get();
 			delta = ktime_sub(t1, t0);
 
-			print_fn_descriptor_symbol("initcall %s()",
-					(unsigned long) *call);
+			print_fn_symbolic("initcall %s", *call);
 			printk(" returned %d after %Ld msecs\n", result,
 				(unsigned long long) delta.tv64 >> 20);
 		}
@@ -737,8 +735,7 @@ static void __init do_initcalls(void)
 			local_irq_enable();
 		}
 		if (msgbuf[0]) {
-			print_fn_descriptor_symbol(KERN_WARNING "initcall %s()",
-					(unsigned long) *call);
+			print_fn_symbolic(KERN_WARNING "initcall %s", *call);
 			printk(" returned with %s\n", msgbuf);
 		}
 	}
-- 
1.5.5.1

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