mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
drm/amdgpu: Handle null atom context in VBIOS info ioctl
[ Upstream commit 5e7e822542 ]
On some APU systems, there is no atom context and so the
atom_context struct is null.
Add a check to the VBIOS_INFO branch of amdgpu_info_ioctl
to handle this case, returning all zeroes.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: David Francis <David.Francis@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ad3c37f90b
commit
91b6845ef3
@@ -896,12 +896,17 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
|
|||||||
struct atom_context *atom_context;
|
struct atom_context *atom_context;
|
||||||
|
|
||||||
atom_context = adev->mode_info.atom_context;
|
atom_context = adev->mode_info.atom_context;
|
||||||
memcpy(vbios_info.name, atom_context->name, sizeof(atom_context->name));
|
if (atom_context) {
|
||||||
memcpy(vbios_info.vbios_pn, atom_context->vbios_pn, sizeof(atom_context->vbios_pn));
|
memcpy(vbios_info.name, atom_context->name,
|
||||||
vbios_info.version = atom_context->version;
|
sizeof(atom_context->name));
|
||||||
memcpy(vbios_info.vbios_ver_str, atom_context->vbios_ver_str,
|
memcpy(vbios_info.vbios_pn, atom_context->vbios_pn,
|
||||||
sizeof(atom_context->vbios_ver_str));
|
sizeof(atom_context->vbios_pn));
|
||||||
memcpy(vbios_info.date, atom_context->date, sizeof(atom_context->date));
|
vbios_info.version = atom_context->version;
|
||||||
|
memcpy(vbios_info.vbios_ver_str, atom_context->vbios_ver_str,
|
||||||
|
sizeof(atom_context->vbios_ver_str));
|
||||||
|
memcpy(vbios_info.date, atom_context->date,
|
||||||
|
sizeof(atom_context->date));
|
||||||
|
}
|
||||||
|
|
||||||
return copy_to_user(out, &vbios_info,
|
return copy_to_user(out, &vbios_info,
|
||||||
min((size_t)size, sizeof(vbios_info))) ? -EFAULT : 0;
|
min((size_t)size, sizeof(vbios_info))) ? -EFAULT : 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user