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: accel/rocket: fix NULL dereference and integer overflow in rocket_job_push()
Date: Mon, 25 May 2026 17:04:16 +1000	[thread overview]
Message-ID: <review-patch1-20260524155716.90955-1-meatuni001@gmail.com> (raw)
In-Reply-To: <20260524155716.90955-1-meatuni001@gmail.com>

Patch Review

**Overflow check — correct:**

```c
+	if (check_add_overflow(job->in_bo_count, job->out_bo_count, &bo_count))
+		return -EINVAL;
```

All three operands are `u32`, so `check_add_overflow()` will correctly detect wrap. Returning `-EINVAL` is appropriate for invalid userspace input.

**NULL check — correct:**

```c
+	bos = kvmalloc_array(bo_count, sizeof(*bos), GFP_KERNEL);
+	if (!bos)
+		return -ENOMEM;
```

This is the standard pattern. Also note the `sizeof(void *)` → `sizeof(*bos)` change is a good improvement (type-safe, follows kernel style).

**Sum replacement in callers — correct:**

The raw `job->in_bo_count + job->out_bo_count` expressions in `drm_gem_lock_reservations()` and `drm_gem_unlock_reservations()` are replaced with the pre-validated `bo_count`. This is both safer and cleaner.

**Minor nit (non-blocking):** The `memcpy` calls on lines 201–202 still use `sizeof(void *)` instead of `sizeof(*bos)`:

```c
	memcpy(bos, job->in_bos, job->in_bo_count * sizeof(void *));
	memcpy(&bos[job->in_bo_count], job->out_bos, job->out_bo_count * sizeof(void *));
```

Since the allocation was changed to `sizeof(*bos)`, it would be more consistent to use `sizeof(*bos)` in the `memcpy` sizes too. Both are equivalent (`bos` is `struct drm_gem_object **`, so `*bos` is a pointer, same size as `void *`), so this is purely cosmetic and not a correctness issue.

**Overall:** Clean, correct fix for two real bugs. Reviewed-by worthy.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-05-25  7:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-24 15:57 [PATCH] accel/rocket: fix NULL dereference and integer overflow in rocket_job_push() Muhammad Bilal
2026-05-25  7:04 ` Claude Code Review Bot [this message]
2026-05-25  7:04 ` Claude review: " 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-patch1-20260524155716.90955-1-meatuni001@gmail.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