diff mbox

[2/5] avoid crash when ep->active is NULL

Message ID 20170706191950.81268-3-luc.vanoostenryck@gmail.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Luc Van Oostenryck July 6, 2017, 7:19 p.m. UTC
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 linearize.c                  |  3 +++
 validation/crash-ep-active.c | 17 +++++++++++++++++
 2 files changed, 20 insertions(+)
 create mode 100644 validation/crash-ep-active.c

Comments

Luc Van Oostenryck July 19, 2017, 10:20 p.m. UTC | #1
This patch fixes a reproducible crash and have been ignored
since it has been posted two weeks ago.
Is there any reasons why?

-- Luc
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christopher Li July 20, 2017, 4:37 a.m. UTC | #2
On Wed, Jul 19, 2017 at 3:20 PM, Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
> This patch fixes a reproducible crash and have been ignored
> since it has been posted two weeks ago.
> Is there any reasons why?

Because you are away? We are discussing the different approach of the first
patch and all the sudden you stop response to email.

Those small patch are trivial to review. Just a ping would be good enough.

BTW, the check should happen before the allocation. Otherwise there is
memory leak.

Chris

        pseudo_t phi = __alloc_pseudo(0);
        static int nr = 0;

+       if (!source)
+               return VOID;
+
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" 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/linearize.c b/linearize.c
index c1ad0c2a4..b76e980dc 100644
--- a/linearize.c
+++ b/linearize.c
@@ -827,6 +827,9 @@  pseudo_t alloc_phi(struct basic_block *source, pseudo_t pseudo, int size)
 	pseudo_t phi = __alloc_pseudo(0);
 	static int nr = 0;
 
+	if (!source)
+		return VOID;
+
 	phi->type = PSEUDO_PHI;
 	phi->nr = ++nr;
 	phi->def = insn;
diff --git a/validation/crash-ep-active.c b/validation/crash-ep-active.c
new file mode 100644
index 000000000..61e17a188
--- /dev/null
+++ b/validation/crash-ep-active.c
@@ -0,0 +1,17 @@ 
+void a(void)
+{
+	0 (0
+		&&
+			({
+				goto b;
+			});
+	);
+}
+
+/*
+ * check-name: crash ep->active
+ * check-command: test-linearize $file
+ *
+ * check-error-ignore
+ * check-output-ignore
+ */