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: gpu: host1x: Fix iommu_map_sgtable() return value check
Date: Thu, 23 Apr 2026 08:57:23 +1000	[thread overview]
Message-ID: <review-patch1-20260421-iommu_map_sgtable-return-v1-1-fb484c07d2a1@nvidia.com> (raw)
In-Reply-To: <20260421-iommu_map_sgtable-return-v1-1-fb484c07d2a1@nvidia.com>

Patch Review

**Status: Good**

The old code assigned `iommu_map_sgtable()` directly into `int err`, which has two problems: (1) it checked `== 0` for failure (inverted vs the new API), and (2) assigning `ssize_t` into `int` could truncate large success values into negative numbers, creating false failures. The commit message correctly identifies both issues.

The fix introduces a properly-typed `ssize_t map_err` local, checks `< 0`, and propagates the actual error instead of a hardcoded `-EINVAL`:

```c
+			ssize_t map_err;
...
+			map_err = iommu_map_sgtable(host->domain, iova_dma_addr(&host->iova, alloc),
+						    map->sgt, IOMMU_READ);
+			if (map_err < 0) {
 				__free_iova(&host->iova, alloc);
-				err = -EINVAL;
+				err = map_err;
```

The `err = map_err` assignment narrows `ssize_t` to `int`, but this is fine on the error path since negative errnos always fit in an `int`.

No issues.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-04-22 22:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21  4:02 [PATCH 0/4] Fix checking of iommu_map_sgtable return value Mikko Perttunen
2026-04-21  4:02 ` [PATCH 1/4] gpu: host1x: Fix iommu_map_sgtable() return value check Mikko Perttunen
2026-04-22 22:57   ` Claude Code Review Bot [this message]
2026-04-21  4:02 ` [PATCH 2/4] drm/tegra: " Mikko Perttunen
2026-04-22 22:57   ` Claude review: " Claude Code Review Bot
2026-04-21  4:02 ` [PATCH 3/4] drm/msm: Fix iommu_map_sgtable() return value check and avoid WARN Mikko Perttunen
2026-04-22 22:57   ` Claude review: " Claude Code Review Bot
2026-04-21  4:02 ` [PATCH 4/4] media: nvidia: tegra-vde: Fix iommu_map_sgtable() return value check Mikko Perttunen
2026-04-22 22:57   ` Claude review: " Claude Code Review Bot
2026-04-22 22:57 ` Claude review: Fix checking of iommu_map_sgtable return value 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-20260421-iommu_map_sgtable-return-v1-1-fb484c07d2a1@nvidia.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