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/ttm drm/ttm: Compare bytes to bytes, n...



details:   https://anonhg.NetBSD.org/src/rev/9e9f1a0f0604
branches:  trunk
changeset: 1028640:9e9f1a0f0604
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 11:34:06 2021 +0000

description:
drm/ttm: Compare bytes to bytes, not pages to bytes.

While here, KASSERT -> KASSERTMSG for better diagnostics.

diffstat:

 sys/external/bsd/drm2/ttm/ttm_bo_vm.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (33 lines):

diff -r 7a9f1ed7f3f7 -r 9e9f1a0f0604 sys/external/bsd/drm2/ttm/ttm_bo_vm.c
--- a/sys/external/bsd/drm2/ttm/ttm_bo_vm.c     Sun Dec 19 11:33:59 2021 +0000
+++ b/sys/external/bsd/drm2/ttm/ttm_bo_vm.c     Sun Dec 19 11:34:06 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ttm_bo_vm.c,v 1.18 2021/12/19 11:09:25 riastradh Exp $ */
+/*     $NetBSD: ttm_bo_vm.c,v 1.19 2021/12/19 11:34:06 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ttm_bo_vm.c,v 1.18 2021/12/19 11:09:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_bo_vm.c,v 1.19 2021/12/19 11:34:06 riastradh Exp $");
 
 #include <sys/types.h>
 
@@ -178,8 +178,12 @@
        KASSERT((ufi->entry->offset & (PAGE_SIZE - 1)) == 0);
        KASSERT(ufi->entry->offset <= size);
        KASSERT((vaddr - ufi->entry->start) <= (size - ufi->entry->offset));
-       KASSERT(npages <= ((size - ufi->entry->offset) -
-               (vaddr - ufi->entry->start)));
+       KASSERTMSG(((size_t)npages << PAGE_SHIFT <=
+               ((size - ufi->entry->offset) - (vaddr - ufi->entry->start))),
+           "vaddr=%jx npages=%d bo=%p is_iomem=%d size=%zu"
+           " start=%jx offset=%jx",
+           (uintmax_t)vaddr, npages, bo, (int)bo->mem.bus.is_iomem, size,
+           (uintmax_t)ufi->entry->start, (uintmax_t)ufi->entry->offset);
        uoffset = (ufi->entry->offset + (vaddr - ufi->entry->start));
        startpage = (uoffset >> PAGE_SHIFT);
        for (i = 0; i < npages; i++) {



Home | Main Index | Thread Index | Old Index