Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] accel/rocket: inaccurate commit message on zero-size BO
  failure path
--

commit 16a770184fb1378b86d900df5443b48c32c09ac4
Author: Hu Xinyao <[email protected]>

accel/rocket: Reject zero-sized BOs in rocket_ioctl_create_bo()

This commit rejects zero-sized buffer objects in rocket_ioctl_create_bo()
with -EINVAL before calling drm_gem_shmem_create().

> rocket_ioctl_create_bo() passes args->size directly to
> drm_gem_shmem_create() and drm_gem_shmem_get_pages_sgt(). When
> args->size is zero, drm_gem_get_pages() allocates a zero-element page
> array (ZERO_SIZE_PTR), and drm_gem_shmem_get_sg_table() calls
> sg_alloc_append_table_from_pages() with n_pages == 0, which initializes
> chunks = 1 and dereferences pages[0].

[Severity: Medium]
Is the commit message accurate about how a zero-sized request fails?

When args->size is 0, drm_gem_shmem_create() calls __drm_gem_shmem_init()
-> drm_gem_create_mmap_offset() -> drm_vma_offset_add() ->
drm_mm_insert_node_in_range() with size == 0, which rejects the 0-page
VMA offset allocation and returns -ENOSPC.  rocket_ioctl_create_bo()
returns ERR_PTR(-ENOSPC) from drm_gem_shmem_create() without reaching
drm_gem_shmem_get_pages_sgt().  The patch changes the return value from
-ENOSPC to -EINVAL and avoids allocating and releasing a zero-length
shmem object.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to