From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/hyperv: validate resolution_count and fix WIN8 fallback
Date: Mon, 25 May 2026 17:45:30 +1000 [thread overview]
Message-ID: <review-patch1-6945b22419c7d404b4954a113de2ac9c900dba93.1779542874.git.me@berkoc.com> (raw)
In-Reply-To: <6945b22419c7d404b4954a113de2ac9c900dba93.1779542874.git.me@berkoc.com>
Patch Review
**Status: Good — no issues found.**
The `resolution_count` bounds check is correct. The parse loop at lines 405–410 of the original iterates `resolution_count` times over `supported_resolution[SYNTHVID_MAX_RESOLUTION_COUNT]` (64 entries), so an unchecked count from the host can cause an out-of-bounds read:
```c
+ if (msg->resolution_resp.resolution_count == 0 ||
+ msg->resolution_resp.resolution_count >
+ SYNTHVID_MAX_RESOLUTION_COUNT) {
+ drm_err(dev, "Invalid resolution count: %d\n",
+ msg->resolution_resp.resolution_count);
return -ENODEV;
```
Folding the upper bound into the existing zero-check is clean. The `%d` format for a `u8` is fine (promoted to `int`).
The fallback refactor is also correct. The original `else` branch only covered pre-WIN10, leaving `screen_width_max` / `screen_height_max` at zero on a failed WIN10 probe, which cascades into `mode_config.max_width = 0` and breaks framebuffer creation. The new guard:
```c
+ if (!hv->screen_width_max) {
hv->screen_width_max = SYNTHVID_WIDTH_WIN8;
hv->screen_height_max = SYNTHVID_HEIGHT_WIN8;
+ hv->preferred_width = SYNTHVID_WIDTH_WIN8;
+ hv->preferred_height = SYNTHVID_HEIGHT_WIN8;
}
```
This works because `screen_width_max` is zero-initialized (the device struct comes from `devm_drm_dev_alloc` → `kzalloc`), and `hyperv_get_supported_resolution()` only sets it to nonzero on success. The pre-WIN10 path also benefits from gaining the `preferred_width`/`preferred_height` defaults that were previously missing. No concerns.
---
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-25 7:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-23 13:27 [PATCH v5 0/2] drm/hyperv: harden host message parsing Berkant Koc
2026-05-19 20:08 ` [PATCH v5 1/2] drm/hyperv: validate resolution_count and fix WIN8 fallback Berkant Koc
2026-05-23 15:16 ` Michael Kelley
2026-05-25 7:45 ` Claude Code Review Bot [this message]
2026-05-23 13:27 ` [PATCH v5 2/2] drm/hyperv: validate VMBus packet size in receive callback Berkant Koc
2026-05-23 15:17 ` Michael Kelley
2026-05-25 7:45 ` Claude review: " Claude Code Review Bot
2026-05-25 7:45 ` Claude review: drm/hyperv: harden host message parsing Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-05-21 20:41 [PATCH v4 0/2] " Berkant Koc
2026-05-19 20:08 ` [PATCH v4 1/2] drm/hyperv: validate resolution_count and fix WIN8 fallback Berkant Koc
2026-05-25 9:37 ` 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-6945b22419c7d404b4954a113de2ac9c900dba93.1779542874.git.me@berkoc.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