public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm: ensure blend mode supported if pixel format with alpha exposed
Date: Wed, 27 May 2026 14:23:00 +1000	[thread overview]
Message-ID: <review-patch2-20260526181700.25310-3-leandro.ribeiro@collabora.com> (raw)
In-Reply-To: <20260526181700.25310-3-leandro.ribeiro@collabora.com>

Patch Review

**Potential NULL pointer dereference.** In `validate_blend_mode_for_alpha_formats()`:

```c
for (i = 0; i < plane->format_count; i++) {
    fmt = drm_format_info(plane->format_types[i]);
    if (fmt->has_alpha) {
```

`drm_format_info()` can return NULL for unknown formats (it only does a `WARN_ON(!info)` internally, then returns NULL). If a buggy driver registers an unknown fourcc, this validation function — which exists precisely to catch driver bugs — would hit a NULL dereference on `fmt->has_alpha`.

This should have a NULL check:

```c
fmt = drm_format_info(plane->format_types[i]);
if (fmt && fmt->has_alpha) {
```

In practice this is unlikely to trigger since any driver with an unknown format would already be very broken, but a validation function should be defensive.

**Otherwise the logic is correct.** The early return when `blend_mode_property` is set avoids unnecessary iteration. The `break` after the first warning avoids spamming the log. The placement in `drm_mode_config_validate()` in the existing `drm_for_each_plane` loop is efficient.

**Minor style nit:** The WARN format string is split across lines:

```c
WARN(1, "[PLANE:%d:%s] pixel format with alpha exposed but "
     "blend mode not setup", plane->base.id, plane->name);
```

"not setup" should be "not set up" (two words — "setup" is a noun, "set up" is the verb/participle form). Very minor.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-05-27  4:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26 18:16 [PATCH v4 0/2] drm/drm_blend: allow blend mode property without PREMULTI Leandro Ribeiro
2026-05-26 18:16 ` [PATCH v4 1/2] " Leandro Ribeiro
2026-05-27  4:23   ` Claude review: " Claude Code Review Bot
2026-05-26 18:17 ` [PATCH v4 2/2] drm: ensure blend mode supported if pixel format with alpha exposed Leandro Ribeiro
2026-05-27  4:23   ` Claude Code Review Bot [this message]
2026-05-27  4:22 ` Claude review: drm/drm_blend: allow blend mode property without PREMULTI Claude Code Review Bot

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=review-patch2-20260526181700.25310-3-leandro.ribeiro@collabora.com \
    --to=claude-review@example.com \
    --cc=dri-devel-reviews@example.com \
    /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