linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] modpost: fix segfault with short symbol names
@ 2009-12-12 11:02 Michal Marek
  2009-12-12 15:26 ` Segher Boessenkool
  2009-12-14 23:41 ` Rusty Russell
  0 siblings, 2 replies; 8+ messages in thread
From: Michal Marek @ 2009-12-12 11:02 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-kbuild, linux-kernek

memcmp() is wrong here, the symbol name can be shorter than KSYMTAB_PFX
or CRC_PFX.

Signed-off-by: Michal Marek <mmarek@suse.cz>
---
 scripts/mod/modpost.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 801a16a..065ee0b 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -515,7 +515,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
 		break;
 	case SHN_ABS:
 		/* CRC'd symbol */
-		if (memcmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {
+		if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {
 			crc = (unsigned int) sym->st_value;
 			sym_update_crc(symname + strlen(CRC_PFX), mod, crc,
 					export);
@@ -559,7 +559,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
 		break;
 	default:
 		/* All exported symbols */
-		if (memcmp(symname, KSYMTAB_PFX, strlen(KSYMTAB_PFX)) == 0) {
+		if (strncmp(symname, KSYMTAB_PFX, strlen(KSYMTAB_PFX)) == 0) {
 			sym_add_exported(symname + strlen(KSYMTAB_PFX), mod,
 					export);
 		}
-- 
1.6.5.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-12-15  5:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-12 11:02 [PATCH] modpost: fix segfault with short symbol names Michal Marek
2009-12-12 15:26 ` Segher Boessenkool
2009-12-14 10:06   ` Michal Marek
2009-12-14 12:29     ` Segher Boessenkool
2009-12-14 13:33     ` Segher Boessenkool
2009-12-14 16:32       ` Michal Marek
2009-12-15  5:14       ` Rusty Russell
2009-12-14 23:41 ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).