Atsushi Nemoto | 19 Jul 17:19

[PATCH] sparse: Make pre_buffer dynamically increasable

I got this error when running sparse on mips kernel with gcc 4.3:

builtin:272:1: warning: Newline in string or character constant

The linux-mips kernel uses '$(CC) -dM -E' to generates arguments for
sparse.  With gcc 4.3, it generates lot of '-D' options and causes
pre_buffer overflow.  The linux-mips kernel can filter unused symbols
out to avoid overflow, but sparse should be fixed anyway.

This patch make pre_buffer dynamically increasable and add extra
checking for overflow instead of silently truncating.

Signed-off-by: Atsushi Nemoto <anemo <at> mba.ocn.ne.jp>
---
diff --git a/lib.c b/lib.c
index 0abcc9a..6e8d09b 100644
--- a/lib.c
+++ b/lib.c
@@ -186,7 +186,8 @@ void die(const char *fmt, ...)
 }

 static unsigned int pre_buffer_size;
-static char pre_buffer[8192];
+static unsigned int pre_buffer_alloc_size;
+static char *pre_buffer;

 int Waddress_space = 1;
 int Wbitwise = 0;
@@ -232,12 +233,20 @@ void add_pre_buffer(const char *fmt, ...)
 	unsigned int size;
(Continue reading)

Atsushi Nemoto | 13 Sep 17:49

Re: [PATCH] sparse: Make pre_buffer dynamically increasable

On Sun, 20 Jul 2008 00:22:24 +0900 (JST), Atsushi Nemoto <anemo <at> mba.ocn.ne.jp> wrote:
> I got this error when running sparse on mips kernel with gcc 4.3:
> 
> builtin:272:1: warning: Newline in string or character constant
> 
> The linux-mips kernel uses '$(CC) -dM -E' to generates arguments for
> sparse.  With gcc 4.3, it generates lot of '-D' options and causes
> pre_buffer overflow.  The linux-mips kernel can filter unused symbols
> out to avoid overflow, but sparse should be fixed anyway.
> 
> This patch make pre_buffer dynamically increasable and add extra
> checking for overflow instead of silently truncating.
> 
> Signed-off-by: Atsushi Nemoto <anemo <at> mba.ocn.ne.jp>

Ping?

> ---
> diff --git a/lib.c b/lib.c
> index 0abcc9a..6e8d09b 100644
> --- a/lib.c
> +++ b/lib.c
> @@ -186,7 +186,8 @@ void die(const char *fmt, ...)
>  }
>  
>  static unsigned int pre_buffer_size;
> -static char pre_buffer[8192];
> +static unsigned int pre_buffer_alloc_size;
> +static char *pre_buffer;
>  
(Continue reading)

Christopher Li | 13 Sep 19:59

Re: [PATCH] sparse: Make pre_buffer dynamically increasable

On Sat, Sep 13, 2008 at 8:49 AM, Atsushi Nemoto <anemo <at> mba.ocn.ne.jp> wrote:
>> This patch make pre_buffer dynamically increasable and add extra
>> checking for overflow instead of silently truncating.
>>

The better way is just remove the pre_buffer completely. Just tokenize
the buffer
and append the result token on the fly.

Can you try out the patch I attached? It does just that.

Chris
Attachment (pre-buffer-tokenize): application/octet-stream, 4375 bytes
Atsushi Nemoto | 14 Sep 14:41

Re: [PATCH] sparse: Make pre_buffer dynamically increasable

On Sat, 13 Sep 2008 10:59:45 -0700, "Christopher Li" <sparse <at> chrisli.org> wrote:
> The better way is just remove the pre_buffer completely. Just tokenize
> the buffer
> and append the result token on the fly.
> 
> Can you try out the patch I attached? It does just that.

Thanks, it works for me.

---
Atsushi Nemoto
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Gmane