Module Name:    src
Committed By:   riastradh
Date:           Sun Dec 19 11:17:02 UTC 2021

Modified Files:
        src/sys/external/bsd/drm2/include/linux: bitmap.h

Log Message:
drm/linux: Fix bitmap_zalloc size.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/include/linux/bitmap.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/bitmap.h
diff -u src/sys/external/bsd/drm2/include/linux/bitmap.h:1.10 src/sys/external/bsd/drm2/include/linux/bitmap.h:1.11
--- src/sys/external/bsd/drm2/include/linux/bitmap.h:1.10	Sun Dec 19 11:16:55 2021
+++ src/sys/external/bsd/drm2/include/linux/bitmap.h	Sun Dec 19 11:17:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: bitmap.h,v 1.10 2021/12/19 11:16:55 riastradh Exp $	*/
+/*	$NetBSD: bitmap.h,v 1.11 2021/12/19 11:17:02 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -218,8 +218,12 @@ bitmap_or(unsigned long *dst, const unsi
 }
 
 static inline unsigned long *
-bitmap_zalloc(size_t size, gfp_t gfp) {
-	return kzalloc(size, gfp);
+bitmap_zalloc(size_t nbits, gfp_t gfp)
+{
+	const size_t bpl = NBBY * sizeof(unsigned long);
+	size_t n = howmany(nbits, bpl);
+
+	return kcalloc(n, sizeof(unsigned long), gfp);
 }
 
 #endif  /* _LINUX_BITMAP_H_ */

Reply via email to