* [PATCH] drm/dumb-buffers: Increase size limits to match current devices
@ 2026-06-02 7:30 Thomas Zimmermann
2026-06-02 10:37 ` Saarinen, Jani
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Thomas Zimmermann @ 2026-06-02 7:30 UTC (permalink / raw)
To: rajat.gupta, jani.nikula, jani.saarinen, simona, airlied, mripard,
maarten.lankhorst
Cc: dri-devel, intel-gfx, intel-xe, Thomas Zimmermann
Increase the limits for dumb-buffer arguments to sizes of 16384x16384
at 64 bpp. Such buffer sizes are still within 32-bit unsigned limits.
Fixes CI and high-end devices.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Fixes: 5ab62dd3687b ("drm: prevent integer overflows in dumb buffer creation helpers")
Reported-by: Jani Nikula <jani.nikula@linux.intel.com>
Closes: https://lore.kernel.org/dri-devel/ddf0233e50044059c85279f928661563ef6a55bf@intel.com/
Cc: Rajat Gupta <rajat.gupta@oss.qualcomm.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
---
drivers/gpu/drm/drm_dumb_buffers.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/drm_dumb_buffers.c b/drivers/gpu/drm/drm_dumb_buffers.c
index e60130b2bb0c..9c4cfb3210aa 100644
--- a/drivers/gpu/drm/drm_dumb_buffers.c
+++ b/drivers/gpu/drm/drm_dumb_buffers.c
@@ -201,11 +201,12 @@ int drm_mode_create_dumb(struct drm_device *dev,
if (!args->width || !args->height || !args->bpp)
return -EINVAL;
- /* Reject unreasonable inputs early. Dumb buffers are for software
- * rendering; nothing legitimate needs more than 8192x8192 at 32bpp.
- * This prevents overflows in downstream alignment helpers.
+ /*
+ * Reject unreasonable inputs early. Dumb buffers are for software
+ * rendering; nothing legitimate needs more than 16384x16384 at
+ * 64 bpp. This prevents overflows in downstream alignment helpers.
*/
- if (args->width >= 8192 || args->height >= 8192 || args->bpp > 32)
+ if (args->width > 16384 || args->height > 16384 || args->bpp > 64)
return -EINVAL;
/* overflow checks for 32bit size calculations */
base-commit: a980196655477a8f5067112946401fe52e510664
--
2.54.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [PATCH] drm/dumb-buffers: Increase size limits to match current devices
2026-06-02 7:30 [PATCH] drm/dumb-buffers: Increase size limits to match current devices Thomas Zimmermann
@ 2026-06-02 10:37 ` Saarinen, Jani
2026-06-02 10:53 ` Jani Nikula
2026-06-04 3:08 ` Claude review: " Claude Code Review Bot
2026-06-04 3:08 ` Claude Code Review Bot
2 siblings, 1 reply; 6+ messages in thread
From: Saarinen, Jani @ 2026-06-02 10:37 UTC (permalink / raw)
To: Thomas Zimmermann, rajat.gupta@oss.qualcomm.com,
jani.nikula@linux.intel.com, simona@ffwll.ch, airlied@gmail.com,
mripard@kernel.org, maarten.lankhorst@linux.intel.com
Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
intel-xe@lists.freedesktop.org
Hi,
> -----Original Message-----
> From: Thomas Zimmermann <tzimmermann@suse.de>
> Sent: Tuesday, 2 June 2026 10.30
> To: rajat.gupta@oss.qualcomm.com; jani.nikula@linux.intel.com; Saarinen,
> Jani <jani.saarinen@intel.com>; simona@ffwll.ch; airlied@gmail.com;
> mripard@kernel.org; maarten.lankhorst@linux.intel.com
> Cc: dri-devel@lists.freedesktop.org; intel-gfx@lists.freedesktop.org; intel-
> xe@lists.freedesktop.org; Thomas Zimmermann <tzimmermann@suse.de>
> Subject: [PATCH] drm/dumb-buffers: Increase size limits to match current
> devices
>
> Increase the limits for dumb-buffer arguments to sizes of 16384x16384 at 64
> bpp. Such buffer sizes are still within 32-bit unsigned limits.
> Fixes CI and high-end devices.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Fixes: 5ab62dd3687b ("drm: prevent integer overflows in dumb buffer
> creation helpers")
> Reported-by: Jani Nikula <jani.nikula@linux.intel.com>
> Closes: https://lore.kernel.org/dri-
> devel/ddf0233e50044059c85279f928661563ef6a55bf@intel.com/
Seems not helping on i915 CI BAT issue https://lore.kernel.org/intel-gfx/178038951063.34290.3796875109342598028@6beec6c84f66/T/#u
=> https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_167719v1/index.html?
> Cc: Rajat Gupta <rajat.gupta@oss.qualcomm.com>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
Br,
Jani
> ---
> drivers/gpu/drm/drm_dumb_buffers.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_dumb_buffers.c
> b/drivers/gpu/drm/drm_dumb_buffers.c
> index e60130b2bb0c..9c4cfb3210aa 100644
> --- a/drivers/gpu/drm/drm_dumb_buffers.c
> +++ b/drivers/gpu/drm/drm_dumb_buffers.c
> @@ -201,11 +201,12 @@ int drm_mode_create_dumb(struct drm_device
> *dev,
> if (!args->width || !args->height || !args->bpp)
> return -EINVAL;
>
> - /* Reject unreasonable inputs early. Dumb buffers are for software
> - * rendering; nothing legitimate needs more than 8192x8192 at
> 32bpp.
> - * This prevents overflows in downstream alignment helpers.
> + /*
> + * Reject unreasonable inputs early. Dumb buffers are for software
> + * rendering; nothing legitimate needs more than 16384x16384 at
> + * 64 bpp. This prevents overflows in downstream alignment helpers.
> */
> - if (args->width >= 8192 || args->height >= 8192 || args->bpp > 32)
> + if (args->width > 16384 || args->height > 16384 || args->bpp > 64)
> return -EINVAL;
>
> /* overflow checks for 32bit size calculations */
>
> base-commit: a980196655477a8f5067112946401fe52e510664
> --
> 2.54.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] drm/dumb-buffers: Increase size limits to match current devices
2026-06-02 10:37 ` Saarinen, Jani
@ 2026-06-02 10:53 ` Jani Nikula
2026-06-02 11:23 ` Thomas Zimmermann
0 siblings, 1 reply; 6+ messages in thread
From: Jani Nikula @ 2026-06-02 10:53 UTC (permalink / raw)
To: Saarinen, Jani, Thomas Zimmermann, rajat.gupta@oss.qualcomm.com,
simona@ffwll.ch, airlied@gmail.com, mripard@kernel.org,
maarten.lankhorst@linux.intel.com
Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
intel-xe@lists.freedesktop.org, Syrjala, Ville
On Tue, 02 Jun 2026, "Saarinen, Jani" <jani.saarinen@intel.com> wrote:
> Hi,
>> -----Original Message-----
>> From: Thomas Zimmermann <tzimmermann@suse.de>
>> Sent: Tuesday, 2 June 2026 10.30
>> To: rajat.gupta@oss.qualcomm.com; jani.nikula@linux.intel.com; Saarinen,
>> Jani <jani.saarinen@intel.com>; simona@ffwll.ch; airlied@gmail.com;
>> mripard@kernel.org; maarten.lankhorst@linux.intel.com
>> Cc: dri-devel@lists.freedesktop.org; intel-gfx@lists.freedesktop.org; intel-
>> xe@lists.freedesktop.org; Thomas Zimmermann <tzimmermann@suse.de>
>> Subject: [PATCH] drm/dumb-buffers: Increase size limits to match current
>> devices
>>
>> Increase the limits for dumb-buffer arguments to sizes of 16384x16384 at 64
>> bpp. Such buffer sizes are still within 32-bit unsigned limits.
>> Fixes CI and high-end devices.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> Fixes: 5ab62dd3687b ("drm: prevent integer overflows in dumb buffer
>> creation helpers")
>> Reported-by: Jani Nikula <jani.nikula@linux.intel.com>
>> Closes: https://lore.kernel.org/dri-
>> devel/ddf0233e50044059c85279f928661563ef6a55bf@intel.com/
>
> Seems not helping on i915 CI BAT issue https://lore.kernel.org/intel-gfx/178038951063.34290.3796875109342598028@6beec6c84f66/T/#u
> => https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_167719v1/index.html?
Right, so vgem_basic has this, among other things:
bo.width = 1<<15;
bo.height = 1<<15;
bo.bpp = 16;
vgem_create(fd, &bo);
i.e. 32768x32768.
Not so sure about this one.
Anyone else care to chime in?
BR,
Jani.
>
>> Cc: Rajat Gupta <rajat.gupta@oss.qualcomm.com>
>> Cc: Thomas Zimmermann <tzimmermann@suse.de>
>> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Cc: Maxime Ripard <mripard@kernel.org>
>
> Br,
> Jani
>
>> ---
>> drivers/gpu/drm/drm_dumb_buffers.c | 9 +++++----
>> 1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_dumb_buffers.c
>> b/drivers/gpu/drm/drm_dumb_buffers.c
>> index e60130b2bb0c..9c4cfb3210aa 100644
>> --- a/drivers/gpu/drm/drm_dumb_buffers.c
>> +++ b/drivers/gpu/drm/drm_dumb_buffers.c
>> @@ -201,11 +201,12 @@ int drm_mode_create_dumb(struct drm_device
>> *dev,
>> if (!args->width || !args->height || !args->bpp)
>> return -EINVAL;
>>
>> - /* Reject unreasonable inputs early. Dumb buffers are for software
>> - * rendering; nothing legitimate needs more than 8192x8192 at
>> 32bpp.
>> - * This prevents overflows in downstream alignment helpers.
>> + /*
>> + * Reject unreasonable inputs early. Dumb buffers are for software
>> + * rendering; nothing legitimate needs more than 16384x16384 at
>> + * 64 bpp. This prevents overflows in downstream alignment helpers.
>> */
>> - if (args->width >= 8192 || args->height >= 8192 || args->bpp > 32)
>> + if (args->width > 16384 || args->height > 16384 || args->bpp > 64)
>> return -EINVAL;
>>
>> /* overflow checks for 32bit size calculations */
>>
>> base-commit: a980196655477a8f5067112946401fe52e510664
>> --
>> 2.54.0
>
--
Jani Nikula, Intel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/dumb-buffers: Increase size limits to match current devices
2026-06-02 10:53 ` Jani Nikula
@ 2026-06-02 11:23 ` Thomas Zimmermann
0 siblings, 0 replies; 6+ messages in thread
From: Thomas Zimmermann @ 2026-06-02 11:23 UTC (permalink / raw)
To: Jani Nikula, Saarinen, Jani, rajat.gupta@oss.qualcomm.com,
simona@ffwll.ch, airlied@gmail.com, mripard@kernel.org,
maarten.lankhorst@linux.intel.com
Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
intel-xe@lists.freedesktop.org, Syrjala, Ville
Hi
Am 02.06.26 um 12:53 schrieb Jani Nikula:
> On Tue, 02 Jun 2026, "Saarinen, Jani" <jani.saarinen@intel.com> wrote:
>> Hi,
>>> -----Original Message-----
>>> From: Thomas Zimmermann <tzimmermann@suse.de>
>>> Sent: Tuesday, 2 June 2026 10.30
>>> To: rajat.gupta@oss.qualcomm.com; jani.nikula@linux.intel.com; Saarinen,
>>> Jani <jani.saarinen@intel.com>; simona@ffwll.ch; airlied@gmail.com;
>>> mripard@kernel.org; maarten.lankhorst@linux.intel.com
>>> Cc: dri-devel@lists.freedesktop.org; intel-gfx@lists.freedesktop.org; intel-
>>> xe@lists.freedesktop.org; Thomas Zimmermann <tzimmermann@suse.de>
>>> Subject: [PATCH] drm/dumb-buffers: Increase size limits to match current
>>> devices
>>>
>>> Increase the limits for dumb-buffer arguments to sizes of 16384x16384 at 64
>>> bpp. Such buffer sizes are still within 32-bit unsigned limits.
>>> Fixes CI and high-end devices.
>>>
>>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>>> Fixes: 5ab62dd3687b ("drm: prevent integer overflows in dumb buffer
>>> creation helpers")
>>> Reported-by: Jani Nikula <jani.nikula@linux.intel.com>
>>> Closes: https://lore.kernel.org/dri-
>>> devel/ddf0233e50044059c85279f928661563ef6a55bf@intel.com/
>> Seems not helping on i915 CI BAT issue https://lore.kernel.org/intel-gfx/178038951063.34290.3796875109342598028@6beec6c84f66/T/#u
>> => https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_167719v1/index.html?
> Right, so vgem_basic has this, among other things:
>
> bo.width = 1<<15;
> bo.height = 1<<15;
> bo.bpp = 16;
> vgem_create(fd, &bo);
>
> i.e. 32768x32768.
>
> Not so sure about this one.
>
> Anyone else care to chime in?
I give up. I'll send out a patch to remove the size limits in a bit. The
rest of the overflow fixes in the broken patch should not be a problem,
I think.
But TBH allocating a dumb buffer of that size makes no sense. Who uses a
2-GiB buffer for software rendering?
And as I mentioned elsewhere, there are reports about devices with GiBs
of VRAM but only a few hundered MiB of PCI-BAR ranges. As we don't have
DMA here, there will be some size limits required to make mmap work
correctly.
Best regards
Thomas
>
>
> BR,
> Jani.
>
>>> Cc: Rajat Gupta <rajat.gupta@oss.qualcomm.com>
>>> Cc: Thomas Zimmermann <tzimmermann@suse.de>
>>> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>>> Cc: Maxime Ripard <mripard@kernel.org>
>> Br,
>> Jani
>>
>>> ---
>>> drivers/gpu/drm/drm_dumb_buffers.c | 9 +++++----
>>> 1 file changed, 5 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/drm_dumb_buffers.c
>>> b/drivers/gpu/drm/drm_dumb_buffers.c
>>> index e60130b2bb0c..9c4cfb3210aa 100644
>>> --- a/drivers/gpu/drm/drm_dumb_buffers.c
>>> +++ b/drivers/gpu/drm/drm_dumb_buffers.c
>>> @@ -201,11 +201,12 @@ int drm_mode_create_dumb(struct drm_device
>>> *dev,
>>> if (!args->width || !args->height || !args->bpp)
>>> return -EINVAL;
>>>
>>> - /* Reject unreasonable inputs early. Dumb buffers are for software
>>> - * rendering; nothing legitimate needs more than 8192x8192 at
>>> 32bpp.
>>> - * This prevents overflows in downstream alignment helpers.
>>> + /*
>>> + * Reject unreasonable inputs early. Dumb buffers are for software
>>> + * rendering; nothing legitimate needs more than 16384x16384 at
>>> + * 64 bpp. This prevents overflows in downstream alignment helpers.
>>> */
>>> - if (args->width >= 8192 || args->height >= 8192 || args->bpp > 32)
>>> + if (args->width > 16384 || args->height > 16384 || args->bpp > 64)
>>> return -EINVAL;
>>>
>>> /* overflow checks for 32bit size calculations */
>>>
>>> base-commit: a980196655477a8f5067112946401fe52e510664
>>> --
>>> 2.54.0
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Claude review: drm/dumb-buffers: Increase size limits to match current devices
2026-06-02 7:30 [PATCH] drm/dumb-buffers: Increase size limits to match current devices Thomas Zimmermann
2026-06-02 10:37 ` Saarinen, Jani
2026-06-04 3:08 ` Claude review: " Claude Code Review Bot
@ 2026-06-04 3:08 ` Claude Code Review Bot
2 siblings, 0 replies; 6+ messages in thread
From: Claude Code Review Bot @ 2026-06-04 3:08 UTC (permalink / raw)
To: dri-devel-reviews
Overall Series Review
Subject: drm/dumb-buffers: Increase size limits to match current devices
Author: Thomas Zimmermann <tzimmermann@suse.de>
Patches: 4
Reviewed: 2026-06-04T13:08:23.071360
---
This is a single patch from Thomas Zimmermann that increases the hardcoded sanity limits for dumb buffer creation from 8192x8192 at 32bpp to 16384x16384 at 64bpp. It fixes commit `5ab62dd3687b` which introduced overly strict limits that broke CI and high-end devices (e.g., 64bpp formats like XRGB16161616F, and resolutions beyond 8K).
**The patch targets an older codebase.** On the current drm-next tree, the file has been significantly refactored — the hardcoded width/height/bpp limits this patch modifies have been entirely removed and replaced with proper overflow-safe arithmetic (`check_mul_overflow`, `DIV_ROUND_UP` with explicit `U32_MAX` bounds, and format-aware pitch calculation via `drm_mode_size_dumb()`). This explains why the patch does not apply cleanly.
This patch is likely intended for **stable backport** or an older branch where the refactoring hasn't landed yet. As a fix for the original limiting commit, the approach is reasonable.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 6+ messages in thread
* Claude review: drm/dumb-buffers: Increase size limits to match current devices
2026-06-02 7:30 [PATCH] drm/dumb-buffers: Increase size limits to match current devices Thomas Zimmermann
2026-06-02 10:37 ` Saarinen, Jani
@ 2026-06-04 3:08 ` Claude Code Review Bot
2026-06-04 3:08 ` Claude Code Review Bot
2 siblings, 0 replies; 6+ messages in thread
From: Claude Code Review Bot @ 2026-06-04 3:08 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Correctness of the new limits:**
The worst-case arithmetic at the new limits (16384 x 16384 x 64bpp):
- `cpp = DIV_ROUND_UP(64, 8) = 8`
- `stride = 8 * 16384 = 131,072`
- `size = 16384 * 131,072 = 2,147,483,648` (0x80000000)
This fits within `u32` (max ~4.29 billion) and `PAGE_ALIGN(0x80000000)` is non-zero, so all downstream overflow checks in the old `drm_mode_create_dumb()` pass. The arithmetic is safe.
**The `>=` to `>` change is correct and intentional:**
```c
- if (args->width >= 8192 || args->height >= 8192 || args->bpp > 32)
+ if (args->width > 16384 || args->height > 16384 || args->bpp > 64)
```
The old code rejected `width == 8192` (off-by-one — the comment said "8192x8192" but the `>=` operator excluded that size). The new code correctly allows `width == 16384` using `>`. This is a good fix.
**64bpp is a legitimate value:**
The current drm-next tree explicitly handles `case 64` in `drm_mode_size_dumb()` for `DRM_FORMAT_{XRGB,XBGR,ARGB,ABGR}16161616F` formats, confirming 64bpp is a real use case. The original 32bpp limit was too restrictive.
**Comment update is appropriate:**
```c
+ /*
+ * Reject unreasonable inputs early. Dumb buffers are for software
+ * rendering; nothing legitimate needs more than 16384x16384 at
+ * 64 bpp. This prevents overflows in downstream alignment helpers.
*/
```
The comment accurately describes the new limits and the multi-line comment style is reformatted to kernel coding style (opening `/*` on its own line).
**Minor observations:**
1. The `Fixes:` tag placement is after `Signed-off-by:` — while not strictly wrong, the conventional ordering in the kernel is `Fixes:` before `Signed-off-by:`. This is a trivial style point.
2. The patch is well-scoped and minimal — it changes exactly what needs to change for the fix.
3. As noted above, this patch is **superseded on drm-next** where the hardcoded limits have been entirely replaced with overflow-safe arithmetic. If this is intended for stable backport to kernels that still have the original limiting code, it looks correct. If it's intended for drm-next, it will need to be dropped or reworked since the target code no longer exists.
**Verdict:** The patch is correct for the codebase version it targets. The arithmetic is safe within u32 bounds, the off-by-one fix (`>=` to `>`) is an improvement, and 64bpp / 16384 resolution are justified by real hardware and formats. The main concern is applicability — this should be applied to the branch containing `5ab62dd3687b`, not drm-next where the code has been refactored away.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-06-04 3:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-02 7:30 [PATCH] drm/dumb-buffers: Increase size limits to match current devices Thomas Zimmermann
2026-06-02 10:37 ` Saarinen, Jani
2026-06-02 10:53 ` Jani Nikula
2026-06-02 11:23 ` Thomas Zimmermann
2026-06-04 3:08 ` Claude review: " Claude Code Review Bot
2026-06-04 3:08 ` Claude Code Review Bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox