Module Name:    src
Committed By:   rin
Date:           Wed Oct  2 01:56:02 UTC 2024

Modified Files:
        src/sys/external/bsd/common/include/linux: bitops.h

Log Message:
linux/bitops: Fix overestimate for BITS_TO_LONGS(9)

Fortunately, this seems harmless except for allocating
excessive buffer memory.

Pointed out by nonaka@, OK riastradh@.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/external/bsd/common/include/linux/bitops.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/common/include/linux/bitops.h
diff -u src/sys/external/bsd/common/include/linux/bitops.h:1.16 src/sys/external/bsd/common/include/linux/bitops.h:1.17
--- src/sys/external/bsd/common/include/linux/bitops.h:1.16	Sun Dec 19 11:03:01 2021
+++ src/sys/external/bsd/common/include/linux/bitops.h	Wed Oct  2 01:56:02 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: bitops.h,v 1.16 2021/12/19 11:03:01 riastradh Exp $	*/
+/*	$NetBSD: bitops.h,v 1.17 2024/10/02 01:56:02 rin Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -107,7 +107,7 @@ sign_extend64(uint64_t x, unsigned n)
 }
 
 #define	BITS_TO_LONGS(n)						\
-	roundup2((n), (sizeof(unsigned long) * CHAR_BIT))
+	howmany((n), (sizeof(unsigned long) * CHAR_BIT))
 
 #define	BITS_PER_TYPE(type)	(sizeof(type) * NBBY)
 #define	BITS_PER_BYTE		NBBY

Reply via email to