mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 04:23:35 +02:00
drm: Fix potential overflow issue in event_string array
When calling scnprintf() to append recovery method to event_string,
the second argument should be `sizeof(event_string) - len`, otherwise
there is a potential overflow problem.
Fixes: b7cf9f4ac1 ("drm: Introduce device wedged event")
Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
Reviewed-by: André Almeida <andrealmeid@igalia.com>
Reviewed-by: Raag Jadav <raag.jadav@intel.com>
Link: https://lore.kernel.org/r/20250409014633.31303-1-jiangfeng@kylinos.cn
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
parent
75680b7cd4
commit
b662b162c3
|
|
@ -549,7 +549,7 @@ int drm_dev_wedged_event(struct drm_device *dev, unsigned long method)
|
|||
if (drm_WARN_ONCE(dev, !recovery, "invalid recovery method %u\n", opt))
|
||||
break;
|
||||
|
||||
len += scnprintf(event_string + len, sizeof(event_string), "%s,", recovery);
|
||||
len += scnprintf(event_string + len, sizeof(event_string) - len, "%s,", recovery);
|
||||
}
|
||||
|
||||
if (recovery)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user