From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: nouveau/gsp: fix NULL pointer dereference in r535 nvenc/ofs alloc Date: Wed, 27 May 2026 15:18:37 +1000 Message-ID: In-Reply-To: <20260526014721.13299-1-zenghongling@kylinos.cn> References: <20260526014721.13299-1-zenghongling@kylinos.cn> <20260526014721.13299-1-zenghongling@kylinos.cn> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **Correctness: The fix itself is correct.** The change from: ```c if (WARN_ON(IS_ERR(args))) return PTR_ERR(args); ``` to: ```c if (WARN_ON(IS_ERR_OR_NULL(args))) return args ? PTR_ERR(args) : -EIO; ``` correctly mirrors the pattern established by `nvkm_gsp_rm_alloc()` in `gsp.= h:418-419`: ```c if (IS_ERR_OR_NULL(argv)) return argv ? PTR_ERR(argv) : -EIO; ``` **Issue 1 (Medium): Incomplete fix =E2=80=94 same bug in ce.c, nvdec.c, nvj= pg.c, and r570/ofa.c** The patch only fixes `r535/nvenc.c` and `r535/ofa.c`, but the exact same `I= S_ERR()`-only pattern exists in: - `r535/ce.c:34` =E2=80=94 `if (WARN_ON(IS_ERR(args)))` / `return PTR_ERR(a= rgs);` - `r535/nvdec.c:33` =E2=80=94 identical pattern - `r535/nvjpg.c:33` =E2=80=94 identical pattern - `r570/ofa.c:16` =E2=80=94 identical pattern Additionally, `r535/fifo.c:88` and `r535/device.c:70,124` have the same pat= tern with `nvkm_gsp_rm_alloc_get()` calls guarded only by `IS_ERR()`. If th= e fix is warranted for nvenc/ofa, it should be applied to all callers for c= onsistency and to avoid the same class of bug. **Issue 2 (Nit): Subject line says "ofs" =E2=80=94 should be "ofa"** The subject line reads `fix NULL pointer dereference in r535 nvenc/ofs allo= c` but the file being fixed is `ofa.c` (Optical Flow Accelerator). This app= ears to be a typo: "ofs" should be "ofa". **Issue 3 (Minor): Choice of `-EIO` for the NULL case** Using `-EIO` for the NULL return matches the existing `nvkm_gsp_rm_alloc()`= convention, so this is consistent. However, `-ENOMEM` might be more semant= ically appropriate since a NULL return from the underlying RPC get function= likely means memory allocation failed. That said, since the existing conve= ntion uses `-EIO`, keeping it consistent is fine. **Summary:** The fix is correct in what it does, but should be expanded to = cover all callers of `nvkm_gsp_rm_alloc_get()` that have the same `IS_ERR()= `-only check. The subject line typo ("ofs" =E2=86=92 "ofa") should also be = corrected. --- Generated by Claude Code Patch Reviewer