linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christopher Li <sparse@chrisli.org>
To: linux-sparse@vger.kernel.org
Cc: Josh Triplett <josh@freedesktop.org>
Subject: [PATCH 3] Fix core dump on huge switch
Date: Fri, 9 Feb 2007 16:16:47 -0800	[thread overview]
Message-ID: <20070210001647.GB20644@chrisli.org> (raw)

Bump up the size of the instruction buffer. vt_ioctl.c has
a huge switch statement causing sparse over flow the instruction
buffer.

Signed-Off-By: Christopher Li <sparse@chrisli.org>

Index: sparse/linearize.c
===================================================================
--- sparse.orig/linearize.c	2007-01-30 20:07:40.000000000 -0800
+++ sparse/linearize.c	2007-01-30 20:48:16.000000000 -0800
@@ -272,7 +272,7 @@ static char *show_asm(char *buf, struct 
 const char *show_instruction(struct instruction *insn)
 {
 	int opcode = insn->opcode;
-	static char buffer[1024];
+	static char buffer[4096];
 	char *buf;
 
 	buf = buffer;
@@ -457,6 +457,9 @@ const char *show_instruction(struct inst
 	default:
 		break;
 	}
+
+	if (buf >= buffer + sizeof buffer)
+		die("instruction buffer overflowed %d\n", buf - buffer);
 	do { --buf; } while (*buf == ' ');
 	*++buf = 0;
 	return buffer;

             reply	other threads:[~2007-02-10  0:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-10  0:16 Christopher Li [this message]
2007-02-26 19:57 ` [PATCH 3] Fix core dump on huge switch Josh Triplett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070210001647.GB20644@chrisli.org \
    --to=sparse@chrisli.org \
    --cc=josh@freedesktop.org \
    --cc=linux-sparse@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).