aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bitmap.c')
-rw-r--r--lib/bitmap.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c
index a2348d19c8b5..5ade00d4219a 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -13,6 +13,7 @@
13#include <linux/bitops.h> 13#include <linux/bitops.h>
14#include <linux/bug.h> 14#include <linux/bug.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/mm.h>
16#include <linux/slab.h> 17#include <linux/slab.h>
17#include <linux/string.h> 18#include <linux/string.h>
18#include <linux/uaccess.h> 19#include <linux/uaccess.h>
@@ -461,14 +462,15 @@ EXPORT_SYMBOL(bitmap_parse_user);
461 * ranges if list is specified or hex digits grouped into comma-separated 462 * ranges if list is specified or hex digits grouped into comma-separated
462 * sets of 8 digits/set. Returns the number of characters written to buf. 463 * sets of 8 digits/set. Returns the number of characters written to buf.
463 * 464 *
464 * It is assumed that @buf is a pointer into a PAGE_SIZE area and that 465 * It is assumed that @buf is a pointer into a PAGE_SIZE, page-aligned
465 * sufficient storage remains at @buf to accommodate the 466 * area and that sufficient storage remains at @buf to accommodate the
466 * bitmap_print_to_pagebuf() output. 467 * bitmap_print_to_pagebuf() output. Returns the number of characters
468 * actually printed to @buf, excluding terminating '\0'.
467 */ 469 */
468int bitmap_print_to_pagebuf(bool list, char *buf, const unsigned long *maskp, 470int bitmap_print_to_pagebuf(bool list, char *buf, const unsigned long *maskp,
469 int nmaskbits) 471 int nmaskbits)
470{ 472{
471 ptrdiff_t len = PTR_ALIGN(buf + PAGE_SIZE - 1, PAGE_SIZE) - buf; 473 ptrdiff_t len = PAGE_SIZE - offset_in_page(buf);
472 int n = 0; 474 int n = 0;
473 475
474 if (len > 1) 476 if (len > 1)