From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: Re: [PATCH] drm/appletbdrm: Use kvzalloc for big allocations Date: Thu, 23 Apr 2026 09:55:24 +1000 Message-ID: In-Reply-To: <302f22e3-5390-4c0a-aa06-bfd02a3175c0@suse.de> References: <302f22e3-5390-4c0a-aa06-bfd02a3175c0@suse.de> <302f22e3-5390-4c0a-aa06-bfd02a3175c0@suse.de> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **NAK =E2=80=94 vmalloc memory cannot be used as a USB DMA transfer buffer.= ** The allocation site: ```c - appletbdrm_state->request =3D kzalloc(request_size, GFP_KERNEL); + appletbdrm_state->request =3D kvzalloc(request_size, GFP_KERNEL); ``` This buffer is subsequently passed to USB bulk transfer at `appletbdrm.c:44= 9`: ```c ret =3D appletbdrm_send_request(adev, &request->header, request_size); ``` Which calls `usb_bulk_msg()` at line 160: ```c ret =3D usb_bulk_msg(udev, usb_sndbulkpipe(udev, adev->out_ep), request, size, &actual_size, APPLETBDRM_BULK_MSG_TIMEOUT); ``` The USB HCD layer DMA-maps this buffer via `dma_map_single()` (`drivers/usb= /core/hcd.c:1488`), and the DMA subsystem explicitly rejects vmalloc addres= ses (`include/linux/dma-mapping.h:513-515`). When `kvzalloc` falls back to = vmalloc under memory pressure =E2=80=94 the exact scenario this patch targe= ts =E2=80=94 the USB transfer will fail. The free-side change is correct in isolation (matching `kvzalloc` with `kvf= ree`), but is moot given the allocation change is wrong: ```c - kfree(appletbdrm_state->request); + kvfree(appletbdrm_state->request); ``` **Suggestion:** Replace `kvzalloc` with `kzalloc` using `__GFP_RETRY_MAYFAI= L`: ```c appletbdrm_state->request =3D kzalloc(request_size, GFP_KERNEL | __GFP_RETR= Y_MAYFAIL); ``` This tells the page allocator to try harder (compacting memory, reclaiming = pages) before giving up, while keeping the allocation physically contiguous= and safe for DMA. No change needed on the free side since `kfree` remains = correct. --- Generated by Claude Code Patch Reviewer