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/linux Allow fence_get(NULL).



details:   https://anonhg.NetBSD.org/src/rev/ca2bb1ac0830
branches:  trunk
changeset: 366544:ca2bb1ac0830
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Sep 01 22:28:04 2018 +0000

description:
Allow fence_get(NULL).

This is kind of silly: if the caller has exclusive access to the
fence, they should be able to guarantee it's there, so this could
serve to suppress legitimate bugs.  But better to preserve Linux
semantics here than to be picky about API design.

Bug by me, fix from Tobias Ulmer in PR kern/53565.

diffstat:

 sys/external/bsd/drm2/linux/linux_fence.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 3edad1fc5f4e -r ca2bb1ac0830 sys/external/bsd/drm2/linux/linux_fence.c
--- a/sys/external/bsd/drm2/linux/linux_fence.c Sat Sep 01 22:01:03 2018 +0000
+++ b/sys/external/bsd/drm2/linux/linux_fence.c Sat Sep 01 22:28:04 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_fence.c,v 1.12 2018/08/28 15:04:02 riastradh Exp $       */
+/*     $NetBSD: linux_fence.c,v 1.13 2018/09/01 22:28:04 riastradh Exp $       */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_fence.c,v 1.12 2018/08/28 15:04:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_fence.c,v 1.13 2018/09/01 22:28:04 riastradh Exp $");
 
 #include <sys/atomic.h>
 #include <sys/condvar.h>
@@ -179,7 +179,8 @@
 fence_get(struct fence *fence)
 {
 
-       kref_get(&fence->refcount);
+       if (fence)
+               kref_get(&fence->refcount);
        return fence;
 }
 



Home | Main Index | Thread Index | Old Index