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 19:37:10 +1000 [thread overview]
Message-ID: <review-patch1-6945b22419c7d404b4954a113de2ac9c900dba93.1779396074.git.me@berkoc.com> (raw)
In-Reply-To: <6945b22419c7d404b4954a113de2ac9c900dba93.1779396074.git.me@berkoc.com>
Patch Review
**Verdict: Good, minor nit.**
**Resolution count bounds check** — Correct and necessary. The existing code only checked for zero:
```c
if (msg->resolution_resp.resolution_count == 0 ||
msg->resolution_resp.resolution_count >
SYNTHVID_MAX_RESOLUTION_COUNT) {
```
Without this, a malicious or buggy host sending `resolution_count > 64` would cause the loop at line 405 to read past `supported_resolution[SYNTHVID_MAX_RESOLUTION_COUNT]`, which is an OOB read on `hv->init_buf`. Since `init_buf` is a flat `u8[0x4000]` inside `struct hyperv_drm_device`, this reads adjacent struct members rather than unmapped memory, but it's still a data-integrity bug that can corrupt `screen_width_max`/`screen_height_max` with garbage.
**WIN8 fallback** — Clean refactoring. The change from:
```c
} else {
hv->screen_width_max = SYNTHVID_WIDTH_WIN8;
hv->screen_height_max = SYNTHVID_HEIGHT_WIN8;
}
```
to:
```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 correctly converges three previously-distinct failure paths (pre-WIN10, WIN10 probe failure, WIN10 invalid count) into a single fallback. It also fixes the pre-WIN10 branch that never populated `preferred_width`/`preferred_height`, which would leave them at 0.
**Nit:** The error message uses `%d` for `resolution_count` which is `u8`:
```c
drm_err(dev, "Invalid resolution count: %d\n",
msg->resolution_resp.resolution_count);
```
`%u` would be more semantically precise for an unsigned type, though `%d` works correctly for `u8` values and is common in the kernel. Not worth a respin.
---
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-25 9:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 20:41 [PATCH v4 0/2] drm/hyperv: harden host message parsing 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 Code Review Bot [this message]
2026-05-19 20:08 ` [PATCH v4 2/2] drm/hyperv: validate VMBus packet size in receive callback Berkant Koc
2026-05-22 21:09 ` Michael Kelley
2026-05-25 9:37 ` Claude review: " Claude Code Review Bot
2026-05-25 9:37 ` Claude review: drm/hyperv: harden host message parsing Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-05-23 13:27 [PATCH v5 0/2] " Berkant Koc
2026-05-19 20:08 ` [PATCH v5 1/2] drm/hyperv: validate resolution_count and fix WIN8 fallback Berkant Koc
2026-05-25 7:45 ` 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.1779396074.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