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: Wed, 25 Mar 2026 07:53:35 +1000	[thread overview]
Message-ID: <review-overall-20260323120051.983301-1-baoli.zhang@linux.intel.com> (raw)
In-Reply-To: <20260323120051.983301-1-baoli.zhang@linux.intel.com>

Overall Series Review

Subject: drm/xe: use krealloc_array to prevent integer overflow
Author: "Baoli.Zhang" <baoli.zhang@linux.intel.com>
Patches: 1
Reviewed: 2026-03-25T07:53:35.984719

---

This is a single-patch series that mechanically replaces `krealloc()` with `krealloc_array()` in two xe driver files. The change is correct in principle — `krealloc_array()` adds an internal overflow check on the multiplication of `count * element_size` — but the practical overflow risk in both call sites is negligible:

1. In `xe_configfs.c`, `count` is a `ssize_t` derived from parsing a user-provided configfs page (bounded by page size), and `sizeof(u32)` is 4. Overflow of `count * 4` is not realistic.
2. In `xe_vm_madvise.c`, `max_vmas` is an `int` starting at 8 and doubling. It would need to reach ~2^30 entries (billions of VMAs) before `max_vmas * sizeof(pointer)` overflows, which is impossible in practice.

That said, using `krealloc_array()` is the accepted kernel coding convention for array allocations and tools like Coccinelle flag these patterns, so the change is reasonable as a hardening/cleanup measure.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-03-24 21:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23 12:00 [PATCH v1] drm/xe: use krealloc_array to prevent integer overflow Baoli.Zhang
2026-03-24 21:53 ` Claude Code Review Bot [this message]
2026-03-24 21:53 ` 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-overall-20260323120051.983301-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