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/include/linux We need to allocate a si...



details:   https://anonhg.NetBSD.org/src/rev/0f0f1fa1e132
branches:  trunk
changeset: 1028568:0f0f1fa1e132
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 11:20:41 2021 +0000

description:
We need to allocate a singular temporary slot, not many.

This also indirectly fixes a panic when nelem == 0.


Author: Maya Rashish <maya%NetBSD.org@localhost>
Committer: Taylor R Campbell <riastradh%NetBSD.org@localhost>

diffstat:

 sys/external/bsd/drm2/include/linux/sort.h |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (21 lines):

diff -r b8c0338a3867 -r 0f0f1fa1e132 sys/external/bsd/drm2/include/linux/sort.h
--- a/sys/external/bsd/drm2/include/linux/sort.h        Sun Dec 19 11:20:33 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/sort.h        Sun Dec 19 11:20:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sort.h,v 1.2 2021/12/19 00:58:50 riastradh Exp $       */
+/*     $NetBSD: sort.h,v 1.3 2021/12/19 11:20:41 riastradh Exp $       */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -47,9 +47,9 @@
        KASSERT(elemsize != 0);
        KASSERT(nelem <= SIZE_MAX/elemsize);
 
-       tmp = kmem_alloc(nelem*elemsize, KM_SLEEP);
+       tmp = kmem_alloc(elemsize, KM_SLEEP);
        kheapsort(array, nelem, elemsize, cmp, tmp);
-       kmem_free(tmp, nelem*elemsize);
+       kmem_free(tmp, elemsize);
 }
 
 #endif /* _LINUX_SORT_H_ */



Home | Main Index | Thread Index | Old Index