]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/log: Fix division by zero when scale module parameter is 0
authorShixiong Ou <oushixiong@kylinos.cn>
Thu, 30 Jul 2026 01:44:40 +0000 (09:44 +0800)
committerJocelyn Falempe <jfalempe@redhat.com>
Thu, 13 Aug 2026 13:46:50 +0000 (15:46 +0200)
commit921ac6cb066d09b5765db892d0db0ffaffa98767
treed56f07497add580e01213d568e38eb57ea0f7051
parent6c916e301fa10de9158b922474ade7b43d726cda
drm/log: Fix division by zero when scale module parameter is 0

The scale module parameter can be set to 0 via kernel command line.
When scale is 0, scaled_font_h and scaled_font_w become 0, causing
a division by zero in the rows/columns calculation.

Since the scale module parameter is read-only (0444 permissions), it
cannot be changed at runtime via sysfs. Clamp it to 1 once in
drm_log_register().

Fixes: 8a4b913df427 ("drm/log: Add integer scaling support")
Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patch.msgid.link/20260730014440.66323-1-oushixiong1025@163.com
Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
drivers/gpu/drm/clients/drm_log.c