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/xe: use krealloc_array to prevent integer overflow
Date: Sun, 12 Apr 2026 11:54:39 +1000	[thread overview]
Message-ID: <review-patch1-20260409012520.3531256-1-baoli.zhang@linux.intel.com> (raw)
In-Reply-To: <20260409012520.3531256-1-baoli.zhang@linux.intel.com>

Patch Review

**xe_configfs.c change:**

```c
-	tmp = krealloc(wa_bb[0].cs, count * sizeof(u32), GFP_KERNEL);
+	tmp = krealloc_array(wa_bb[0].cs, count, sizeof(u32), GFP_KERNEL);
```

Correct transformation. `count` is `ssize_t` (line 755), so the original `count * sizeof(u32)` is a `size_t` multiplication that could theoretically wrap. `krealloc_array()` handles this safely. One observation: `count` can be 0 here (there's an explicit `if (!count)` check at line 776 after the allocation), and `krealloc_array` with count=0 will behave as `ZERO_SIZE_PTR` or free — the existing code handles this path correctly since `!tmp` is checked and the `!count` case returns early anyway.

**xe_vm_madvise.c change:**

```c
-		__vmas = krealloc(madvise_range->vmas,
-				  max_vmas * sizeof(*madvise_range->vmas),
-				  GFP_KERNEL);
+		__vmas = krealloc_array(madvise_range->vmas,
+					max_vmas,
+					sizeof(*madvise_range->vmas),
+					GFP_KERNEL);
```

Correct transformation. `max_vmas` is `int` starting at 8 and doubling (`max_vmas <<= 1`). The overflow risk is theoretical (would need ~2^31 VMAs), but using the safe API is the right pattern. The continuation-line alignment matches the opening parenthesis, which is the expected kernel style.

**Nit (non-blocking):** The Signed-off-by chain has `Junxiao.Chang` as a second signoff but there's no `Co-developed-by` tag, nor is there a `Reviewed-by` or `Suggested-by`. If Junxiao co-developed this, kernel convention requires a `Co-developed-by` tag immediately before their `Signed-off-by`. If they only reviewed it, it should be `Reviewed-by` instead.

**Overall: Reviewed-by worthy.** Straightforward, correct, mechanical improvement.

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-04-12  1:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-09  1:25 [PATCH v2] drm/xe: use krealloc_array to prevent integer overflow Baoli.Zhang
2026-04-12  1:54 ` Claude review: " Claude Code Review Bot
2026-04-12  1:54 ` Claude Code Review Bot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-03-23 12:00 [PATCH v1] " Baoli.Zhang
2026-03-24 21:53 ` Claude review: " Claude Code Review Bot
2026-03-24 21:53 ` 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-20260409012520.3531256-1-baoli.zhang@linux.intel.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