From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: drm/lease: cap object_count to avoid order > MAX_PAGE_ORDER warning Date: Wed, 27 May 2026 15:13:21 +1000 Message-ID: In-Reply-To: <20260526055359.17392-1-devnexen@gmail.com> References: <20260526055359.17392-1-devnexen@gmail.com> <20260526055359.17392-1-devnexen@gmail.com> 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: Good.** The check is placed after `cl->object_count` is read= into `object_count` (line 514) and before it's used for the `memdup_array_= user` call (line 525) and passed to `fill_object_idr` =E2=86=92 `kzalloc_ob= js` (line 389). The `goto out_lessor` target correctly drops the `drm_maste= r` reference obtained at line 506. The fix prevents both the `kzalloc_objs`= allocation (array of pointers, 8 bytes each on 64-bit =E2=86=92 4096 * 8 = =3D 32KB, well within a single page order) and the `memdup_array_user` allo= cation (4096 * 4 =3D 16KB) from going overboard. **Nit 1 =E2=80=94 Format specifier mismatch:** ```c drm_dbg_lease(dev, "object_count %zu exceeds max %u\n", object_count, DRM_MAX_LEASE_OBJECTS); ``` `object_count` is `size_t` so `%zu` is correct for it. `DRM_MAX_LEASE_OBJEC= TS` is `4096` which is an `int` constant, so `%u` works but `%d` would be m= ore conventional for a plain integer literal. This is not a bug, just a min= or style point =E2=80=94 either is fine. **Nit 2 =E2=80=94 Limit derivation vs. hard-coded constant.** The value `40= 96` is chosen to sit below the `MAX_PAGE_ORDER` threshold. A more self-docu= menting approach would derive the limit from the actual allocation size, e.= g.: ```c #define DRM_MAX_LEASE_OBJECTS \ ((PAGE_SIZE << MAX_PAGE_ORDER) / sizeof(struct drm_mode_object *)) ``` That said, the hard-coded `4096` is generous enough for any realistic use (= real leases have a handful of objects) and simple to understand. The commen= t explains the rationale. This is a matter of taste, not correctness. **Nit 3 =E2=80=94 `unlikely()` annotation.** The `unlikely()` on line 515 i= s fine and conventional for error-path guards on ioctl inputs, though opini= ons vary on whether the branch predictor needs the hint here. No issue. **Nit 4 =E2=80=94 Placement of the `#define`.** The `DRM_MAX_LEASE_OBJECTS`= macro is placed between `fill_object_idr()` and `drm_mode_create_lease_ioc= tl()` in the middle of the file. Placing it near the top of the file with o= ther constants or near the include block would be slightly more conventiona= l, but this is minor. **Overall:** The patch is correct, well-targeted, and addresses the reporte= d syzbot issue cleanly. The commit message is clear and includes appropriat= e tags (Reported-by, Closes, Fixes, Signed-off-by). Good to merge with or w= ithout the nits addressed. --- Generated by Claude Code Patch Reviewer