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 drm/mm: Assert invariant of a...



details:   https://anonhg.NetBSD.org/src/rev/222c6b225795
branches:  trunk
changeset: 361568:222c6b225795
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Feb 14 13:22:11 2022 +0000

description:
drm/mm: Assert invariant of another rb lookup.

This one looks a little more questionable.

diffstat:

 sys/external/bsd/drm2/dist/drm/drm_mm.c |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r 9bdce9e99f03 -r 222c6b225795 sys/external/bsd/drm2/dist/drm/drm_mm.c
--- a/sys/external/bsd/drm2/dist/drm/drm_mm.c   Mon Feb 14 13:02:31 2022 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_mm.c   Mon Feb 14 13:22:11 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_mm.c,v 1.15 2022/02/14 13:02:31 riastradh Exp $    */
+/*     $NetBSD: drm_mm.c,v 1.16 2022/02/14 13:22:11 riastradh Exp $    */
 
 /**************************************************************************
  *
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_mm.c,v 1.15 2022/02/14 13:02:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_mm.c,v 1.16 2022/02/14 13:22:11 riastradh Exp $");
 
 #include <linux/export.h>
 #include <linux/interval_tree_generic.h>
@@ -430,7 +430,14 @@
 static struct drm_mm_node *find_hole(struct drm_mm *mm, u64 addr)
 {
 #ifdef __NetBSD__
-       return rb_tree_find_node_leq(&mm->holes_addr.rbr_tree, &addr);
+       struct drm_mm_node *node;
+
+       node = rb_tree_find_node_leq(&mm->holes_addr.rbr_tree, &addr);
+       KASSERT(node == NULL || __drm_mm_hole_node_start(node) <= addr);
+       KASSERT(node == NULL || addr <
+           __drm_mm_hole_node_start(node) + node->hole_size);
+
+       return node;
 #else
        struct rb_node *rb = mm->holes_addr.rb_node;
        struct drm_mm_node *node = NULL;



Home | Main Index | Thread Index | Old Index