Linux SPARSE checker discussions
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Ben Dooks <ben.dooks@codethink.co.uk>
Cc: linux-sparse@vger.kernel.org
Subject: Re: segfault with latest arm64 linux kernel build
Date: Wed, 17 Jun 2026 17:37:02 +0300	[thread overview]
Message-ID: <ajKxDqLtrI2kiypt@stanley.mountain> (raw)
In-Reply-To: <0e0a2543-bac9-41d3-9c06-1579395a1de4@codethink.co.uk>

There is a NULL dereference parsing a goto.

The got is in the msm_gem_lock_vm_and_obj() function when it calls
the drm_exec_retry_on_contention(exec) macro.

The pre-processed code looks something like this:

__UNIQUE_ID_drm_exec_1299:
	for (void *const __attribute__((__unused__)) __drm_exec_retry_ptr = &&__UNIQUE_ID_drm_exec_1299;
		drm_exec_cleanup(exec);) {
...
		if (drm_exec_is_contended(exec))
			goto *__drm_exec_retry_ptr;

Adding a NULL check fixes the crash but that might not be the
right way to actually fix it.

---
 simplify.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/simplify.c b/simplify.c
index 68c5f9c74021..897fc827dc98 100644
--- a/simplify.c
+++ b/simplify.c
@@ -2734,7 +2734,7 @@ static int simplify_cgoto(struct instruction *insn)
 		break;
 	case OP_LABEL:
 		target = def->bb_true;
-		if (!target->ep)
+		if (!target || !target->ep)
 			return 0;
 		FOR_EACH_PTR(insn->multijmp_list, jmp) {
 			if (jmp->target == target)
-- 
2.53.0


      parent reply	other threads:[~2026-06-17 14:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-17 13:58 segfault with latest arm64 linux kernel build Ben Dooks
2026-06-17 14:16 ` Ben Dooks
2026-06-17 14:20   ` Ben Dooks
2026-06-17 14:37   ` Dan Carpenter [this message]

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=ajKxDqLtrI2kiypt@stanley.mountain \
    --to=error27@gmail.com \
    --cc=ben.dooks@codethink.co.uk \
    --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