Commit 9abee515 authored by Zhou Qingyang's avatar Zhou Qingyang Committed by Greg Kroah-Hartman
Browse files

drm/nouveau/acr: Fix undefined behavior in nvkm_acr_hsfw_load_bl()



[ Upstream commit 2343bcdb ]

In nvkm_acr_hsfw_load_bl(), the return value of kmalloc() is directly
passed to memcpy(), which could lead to undefined behavior on failure
of kmalloc().

Fix this bug by using kmemdup() instead of kmalloc()+memcpy().

This bug was found by a static analyzer.

Builds with 'make allyesconfig' show no new warnings,
and our static analyzer no longer warns about this code.

Fixes: 22dcda45 ("drm/nouveau/acr: implement new subdev to replace "secure boot"")
Signed-off-by: default avatarZhou Qingyang <zhou1615@umn.edu>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220124165856.57022-1-zhou1615@umn.edu


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 47402eaf
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment