All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ethan Tidmore" <ethantidmore06@gmail.com>
To: "Dan Carpenter" <error27@gmail.com>,
	"Ethan Tidmore" <ethantidmore06@gmail.com>
Cc: <smatch@vger.kernel.org>
Subject: Re: [SMATCH] Can also be NULL false positive
Date: Wed, 08 Apr 2026 08:40:19 -0500	[thread overview]
Message-ID: <DHNTDUBD6ZZK.3UPTDAOZOQTZ7@gmail.com> (raw)
In-Reply-To: <adX58llnf1fJEqUm@stanley.mountain>

On Wed Apr 8, 2026 at 1:47 AM CDT, Dan Carpenter wrote:
> On Tue, Apr 07, 2026 at 11:16:45AM -0500, Ethan Tidmore wrote:
>> Hi Dan,
>> 
>> Smatch gives these two warnings: 
>> 
>> drivers/gpu/drm/i915/display/intel_crtc.c:333 __intel_crtc_init() warn: 'primary' can also be NULL
>> drivers/gpu/drm/i915/display/intel_crtc.c:348 __intel_crtc_init() warn: 'plane' can also be NULL
>> 
>> 	if (DISPLAY_VER(display) >= 9)
>> 		primary = skl_universal_plane_create(display, pipe, PLANE_1);
>> 	else
>> 		primary = intel_primary_plane_create(display, pipe);
>> 	if (IS_ERR(primary)) {
>> 		ret = PTR_ERR(primary);
>> 		goto fail;
>> 	}
>> 	crtc->plane_ids_mask |= BIT(primary->id);
>> 
>> and
>> 
>> 		if (DISPLAY_VER(display) >= 9)
>> 			plane = skl_universal_plane_create(display, pipe, PLANE_2 + sprite);
>> 		else
>> 			plane = intel_sprite_plane_create(display, pipe, sprite);
>> 		if (IS_ERR(plane)) {
>> 			ret = PTR_ERR(plane);
>> 			goto fail;
>> 		}
>> 		crtc->plane_ids_mask |= BIT(plane->id);
>> 
>> But, this is a false positive because skl_universal_plane_create() and
>> intel_sprite_plane_create() never return NULL and always error pointers.
>
> I don't see that warning on my builds.
>
> One thing that I see is that intel_primary_plane_create() can return NULL
> if CONFIG_I915 is disabled.  But I can't see how we would build that
> file without CONFIG_I915.  I wondered if it might be a CONFIG_COMPILE_TEST
> thing, but I don't see that possibility.
>
> Do you have the cross function DB built?

I'm building with 'allmodconfig' and using these smatch scripts:

./smatch/smatch_scripts/build_kernel_data.sh
./smatch/smatch_scripts/test_kernel.sh --endian

Thanks,

ET

>
> regards,
> dan carpenter


      reply	other threads:[~2026-04-08 13:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07 16:16 [SMATCH] Can also be NULL false positive Ethan Tidmore
2026-04-08  6:47 ` Dan Carpenter
2026-04-08 13:40   ` Ethan Tidmore [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=DHNTDUBD6ZZK.3UPTDAOZOQTZ7@gmail.com \
    --to=ethantidmore06@gmail.com \
    --cc=error27@gmail.com \
    --cc=smatch@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 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.