DragonFlyBSD Kernel Audit
DF-1951 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/drm/amd/amdgpu/amdgpu_bios.c b/sys/dev/drm/amd/amdgpu/amdgpu_bios.c
--- a/sys/dev/drm/amd/amdgpu/amdgpu_bios.c
+++ b/sys/dev/drm/amd/amdgpu/amdgpu_bios.c
@@ -104,6 +104,9 @@
 	}
 
 	adev->bios = kmalloc(size, M_DRM, GFP_KERNEL);
+	/* Pre-zero the whole buffer so we never leak uninitialized kernel
+	 * heap if ATRM only partially fills it. */
+	memset(adev->bios, 0, size);
 	if (!adev->bios) {
 		iounmap(bios);
 		return false;