All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] avoid crash with test-linearize -vv
@ 2017-03-19 18:01 Luc Van Oostenryck
  2017-03-24  3:03 ` Christopher Li
  0 siblings, 1 reply; 3+ messages in thread
From: Luc Van Oostenryck @ 2017-03-19 18:01 UTC (permalink / raw)
  To: linux-sparse; +Cc: Christopher Li, Dibyendu Majumdar, Luc Van Oostenryck

When verbose is set to 2 or higher, show_instruction()
also display removed instructions. Some of these instructions
can have their associated symbol removed and set to NULL
which will cause a crash with 'test-linearize -vv'.

Fix this by avoiding to dereference symbol's details of
removed instructions.
---
 linearize.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/linearize.c b/linearize.c
index 4ebd6d6d8..1bbada887 100644
--- a/linearize.c
+++ b/linearize.c
@@ -319,6 +319,8 @@ const char *show_instruction(struct instruction *insn)
 		struct symbol *sym = insn->symbol->sym;
 		buf += sprintf(buf, "%s <- ", show_pseudo(insn->target));
 
+		if (!insn->bb && !sym)
+			break;
 		if (sym->bb_target) {
 			buf += sprintf(buf, ".L%u", sym->bb_target->nr);
 			break;
-- 
2.12.0


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

* Re: [PATCH] avoid crash with test-linearize -vv
  2017-03-19 18:01 [PATCH] avoid crash with test-linearize -vv Luc Van Oostenryck
@ 2017-03-24  3:03 ` Christopher Li
  2017-03-24  7:49   ` Luc Van Oostenryck
  0 siblings, 1 reply; 3+ messages in thread
From: Christopher Li @ 2017-03-24  3:03 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: Linux-Sparse, Dibyendu Majumdar

On Sun, Mar 19, 2017 at 11:01 AM, Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
> When verbose is set to 2 or higher, show_instruction()
> also display removed instructions. Some of these instructions
> can have their associated symbol removed and set to NULL
> which will cause a crash with 'test-linearize -vv'.
>
> Fix this by avoiding to dereference symbol's details of
> removed instructions.

I like to apply it. Can you add SOB?

Thanks

Chris

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

* Re: [PATCH] avoid crash with test-linearize -vv
  2017-03-24  3:03 ` Christopher Li
@ 2017-03-24  7:49   ` Luc Van Oostenryck
  0 siblings, 0 replies; 3+ messages in thread
From: Luc Van Oostenryck @ 2017-03-24  7:49 UTC (permalink / raw)
  To: Christopher Li; +Cc: Linux-Sparse, Dibyendu Majumdar

On Thu, Mar 23, 2017 at 08:03:36PM -0700, Christopher Li wrote:
> On Sun, Mar 19, 2017 at 11:01 AM, Luc Van Oostenryck
> <luc.vanoostenryck@gmail.com> wrote:
> > When verbose is set to 2 or higher, show_instruction()
> > also display removed instructions. Some of these instructions
> > can have their associated symbol removed and set to NULL
> > which will cause a crash with 'test-linearize -vv'.
> >
> > Fix this by avoiding to dereference symbol's details of
> > removed instructions.
> 
> I like to apply it. Can you add SOB?

Sure.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>

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

end of thread, other threads:[~2017-03-24  7:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-19 18:01 [PATCH] avoid crash with test-linearize -vv Luc Van Oostenryck
2017-03-24  3:03 ` Christopher Li
2017-03-24  7:49   ` Luc Van Oostenryck

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.