Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu: Handle null atom context in VBIOS info ioctl

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>

authored by

David Francis and committed by
Alex Deucher
86f2ec22 ffde7210

+11 -6
+11 -6
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
··· 951 951 struct atom_context *atom_context; 952 952 953 953 atom_context = adev->mode_info.atom_context; 954 - memcpy(vbios_info.name, atom_context->name, sizeof(atom_context->name)); 955 - memcpy(vbios_info.vbios_pn, atom_context->vbios_pn, sizeof(atom_context->vbios_pn)); 956 - vbios_info.version = atom_context->version; 957 - memcpy(vbios_info.vbios_ver_str, atom_context->vbios_ver_str, 958 - sizeof(atom_context->vbios_ver_str)); 959 - memcpy(vbios_info.date, atom_context->date, sizeof(atom_context->date)); 954 + if (atom_context) { 955 + memcpy(vbios_info.name, atom_context->name, 956 + sizeof(atom_context->name)); 957 + memcpy(vbios_info.vbios_pn, atom_context->vbios_pn, 958 + sizeof(atom_context->vbios_pn)); 959 + vbios_info.version = atom_context->version; 960 + memcpy(vbios_info.vbios_ver_str, atom_context->vbios_ver_str, 961 + sizeof(atom_context->vbios_ver_str)); 962 + memcpy(vbios_info.date, atom_context->date, 963 + sizeof(atom_context->date)); 964 + } 960 965 961 966 return copy_to_user(out, &vbios_info, 962 967 min((size_t)size, sizeof(vbios_info))) ? -EFAULT : 0;