]> git.hungrycats.org Git - linux/commit
drm/sysfb: Avoid truncating maximum stride
authorThomas Zimmermann <tzimmermann@suse.de>
Thu, 18 Jun 2026 08:42:00 +0000 (10:42 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Mon, 22 Jun 2026 09:03:23 +0000 (11:03 +0200)
commit9206b22fb959f4a9cf1921f34aed0df1dcb1ab04
treec1f488a07880932becb497bd6590d2cec78fd1de
parent7bab0f09d753f098977bbba3955d694c2e2c25da
drm/sysfb: Avoid truncating maximum stride

Passing a maximum as 64-bit type to drm_sysfb_get_validated_int0()
can truncate the value to 32 bits. Use drm_sysfb_get_validated_size0(),
which uses 64-bit arithmetics. Then test the returned stride against
the limits of int to avoid truncations in the returned value. A valid
stride is in the range of [1, INT_MAX] inclusive.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/dri-devel/20260617114016.5A5991F000E9@smtp.kernel.org/
Fixes: 32ae90c66fb6 ("drm/sysfb: Add efidrm for EFI displays")
Fixes: a84eb6abe2b6 ("drm/sysfb: Add vesadrm for VESA displays")
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Javier Martinez Canillas <javierm@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Cc: <stable@vger.kernel.org> # v6.16+
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patch.msgid.link/20260618084327.46567-5-tzimmermann@suse.de
drivers/gpu/drm/sysfb/drm_sysfb_screen_info.c