Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/ttm drm/ttm: Avoid uninitiali...



details:   https://anonhg.NetBSD.org/src/rev/6197cdf7ff42
branches:  trunk
changeset: 361566:6197cdf7ff42
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Feb 14 09:25:39 2022 +0000

description:
drm/ttm: Avoid uninitialized mem in error branch.

Not sure why this error branch is getting hit, but let's not make the
problem worse by choking on stack garbage.

Candidate fix for symptom of PR kern/56565, PR kern/56711.
Underlying problem -- that ttm_bo_mem_space fails with ENOMEM --
remains.

diffstat:

 sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r b4c060d0c11f -r 6197cdf7ff42 sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c
--- a/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c       Mon Feb 14 09:23:32 2022 +0000
+++ b/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c       Mon Feb 14 09:25:39 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ttm_bo.c,v 1.30 2021/12/23 17:09:25 hannken Exp $      */
+/*     $NetBSD: ttm_bo.c,v 1.31 2022/02/14 09:25:39 riastradh Exp $    */
 
 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**************************************************************************
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ttm_bo.c,v 1.30 2021/12/23 17:09:25 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_bo.c,v 1.31 2022/02/14 09:25:39 riastradh Exp $");
 
 #define pr_fmt(fmt) "[TTM] " fmt
 
@@ -1190,6 +1190,7 @@
 
        dma_resv_assert_held(bo->base.resv);
 
+       memset(&mem, 0, sizeof(mem));
        mem.num_pages = bo->num_pages;
        mem.size = mem.num_pages << PAGE_SHIFT;
        mem.page_alignment = bo->mem.page_alignment;



Home | Main Index | Thread Index | Old Index