Module Name: src Committed By: riastradh Date: Sun Dec 19 11:20:41 UTC 2021
Modified Files: src/sys/external/bsd/drm2/include/linux: sort.h Log Message: We need to allocate a singular temporary slot, not many. This also indirectly fixes a panic when nelem == 0. Author: Maya Rashish <m...@netbsd.org> Committer: Taylor R Campbell <riastr...@netbsd.org> To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/sort.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/external/bsd/drm2/include/linux/sort.h diff -u src/sys/external/bsd/drm2/include/linux/sort.h:1.2 src/sys/external/bsd/drm2/include/linux/sort.h:1.3 --- src/sys/external/bsd/drm2/include/linux/sort.h:1.2 Sun Dec 19 00:58:50 2021 +++ src/sys/external/bsd/drm2/include/linux/sort.h Sun Dec 19 11:20:41 2021 @@ -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 @@ sort(void *array, size_t nelem, size_t e 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_ */