All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scripts/mod/modpost.c: Fix bug in number_prefix
@ 2014-06-25  8:46 Rasmus Villemoes
  2014-06-25 14:26 ` Paul Gortmaker
  0 siblings, 1 reply; 8+ messages in thread
From: Rasmus Villemoes @ 2014-06-25  8:46 UTC (permalink / raw)
  To: Rusty Russell, Paul Gortmaker, H. Peter Anvin, Andrew Morton
  Cc: linux-kernel, Rasmus Villemoes

The function number_prefix() can currently only return 1 if its
argument is the empty string: If line 3 is reached and *sym (now the
second character in the argument) is not '.', 0 is returned. However,
if that character is '.', the first assignment to c is that same '.',
which obviously fails to be a digit.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 scripts/mod/modpost.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 9d9c5b9..336f45f 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -778,9 +778,9 @@ static const char *sech_name(struct elf_info *elf, Elf_Shdr *sechdr)
  */
 static int number_prefix(const char *sym)
 {
-	if (*sym++ == '\0')
+	if (*sym == '\0')
 		return 1;
-	if (*sym != '.')
+	if (*sym++ != '.')
 		return 0;
 	do {
 		char c = *sym++;
-- 
1.9.2


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

end of thread, other threads:[~2014-07-10  1:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-25  8:46 [PATCH] scripts/mod/modpost.c: Fix bug in number_prefix Rasmus Villemoes
2014-06-25 14:26 ` Paul Gortmaker
2014-06-25 22:57   ` Rasmus Villemoes
2014-07-08 23:58     ` Rusty Russell
2014-07-09  7:13       ` Sam Ravnborg
2014-07-09  9:41         ` [PATCH] scripts: modpost: Remove numeric suffix pattern matching Rasmus Villemoes
2014-07-09 20:47           ` Sam Ravnborg
2014-07-10  1:14             ` Rusty Russell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.