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 drm/linux: Fix bitmap_za...



details:   https://anonhg.NetBSD.org/src/rev/4788b2d43f89
branches:  trunk
changeset: 1028541:4788b2d43f89
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 11:17:02 2021 +0000

description:
drm/linux: Fix bitmap_zalloc size.

diffstat:

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

diffs (24 lines):

diff -r 61652213062f -r 4788b2d43f89 sys/external/bsd/drm2/include/linux/bitmap.h
--- a/sys/external/bsd/drm2/include/linux/bitmap.h      Sun Dec 19 11:16:55 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/bitmap.h      Sun Dec 19 11:17:02 2021 +0000
@@ -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 @@
 }
 
 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_ */



Home | Main Index | Thread Index | Old Index