diff mbox

[2/3] Kbuild: Handle longer symbols in kallsyms.c

Message ID 1382456783-22826-3-git-send-email-andi@firstfloor.org (mailing list archive)
State New, archived
Headers show

Commit Message

Andi Kleen Oct. 22, 2013, 3:46 p.m. UTC
From: Andi Kleen <ak@linux.intel.com>

Also warn for too long symbols

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 scripts/kallsyms.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Joe Perches Oct. 22, 2013, 4:36 p.m. UTC | #1
On Tue, 2013-10-22 at 08:46 -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
> 
> Also warn for too long symbols

[]

> diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
[]
> @@ -27,7 +27,7 @@
>  #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
>  #endif
>  
> -#define KSYM_NAME_LEN		128
> +#define KSYM_NAME_LEN		256

Maybe nicer to get these #defines via #include <>
to avoid getting out of sync.
 
>  struct sym_entry {
>  	unsigned long long addr;
> @@ -118,6 +118,12 @@ static int read_symbol(FILE *in, struct sym_entry *s)
>  			fprintf(stderr, "Read error or end of file.\n");
>  		return -1;
>  	}
> +	if (strlen(str) > KSYM_NAME_LEN) {
> +		fprintf(stderr, "Symbol %s too long for kallsyms.\n"
> +                                "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c",
> +			str);

Missing newline?

Also maybe nicer to show symbol length and KSYM_NAME_LEN values.


--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 6940f00..46264c7 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -27,7 +27,7 @@ 
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
 #endif
 
-#define KSYM_NAME_LEN		128
+#define KSYM_NAME_LEN		256
 
 struct sym_entry {
 	unsigned long long addr;
@@ -118,6 +118,12 @@  static int read_symbol(FILE *in, struct sym_entry *s)
 			fprintf(stderr, "Read error or end of file.\n");
 		return -1;
 	}
+	if (strlen(str) > KSYM_NAME_LEN) {
+		fprintf(stderr, "Symbol %s too long for kallsyms.\n"
+                                "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c",
+			str);
+		return -1;
+	}
 
 	sym = str;
 	/* skip prefix char */