[merged] lib-bitmapc-simplify-bitmap_print_to_pagebuf.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: lib/bitmap.c: simplify bitmap_print_to_pagebuf()
has been removed from the -mm tree.  Its filename was
     lib-bitmapc-simplify-bitmap_print_to_pagebuf.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
Subject: lib/bitmap.c: simplify bitmap_print_to_pagebuf()

len is guaranteed to lie in [1, PAGE_SIZE].  If scnprintf is called with a
buffer size of 1, it is guaranteed to return 0.  So in the extremely
unlikely case of having just one byte remaining in the page, let's just
call scnprintf anyway.  The only difference is that this will write a '\0'
to that final byte in the page, but that's an improvement: We now
guarantee that after the call, buf is a properly terminated C string of
length exactly the return value.

Link: http://lkml.kernel.org/r/20180818131623.8755-8-linux@xxxxxxxxxxxxxxxxxx
Signed-off-by: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
Cc: Yury Norov <ynorov@xxxxxxxxxxxxxxxxxx>
Cc: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
Cc: Sudeep Holla <sudeep.holla@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 lib/bitmap.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

--- a/lib/bitmap.c~lib-bitmapc-simplify-bitmap_print_to_pagebuf
+++ a/lib/bitmap.c
@@ -471,12 +471,9 @@ int bitmap_print_to_pagebuf(bool list, c
 			    int nmaskbits)
 {
 	ptrdiff_t len = PAGE_SIZE - offset_in_page(buf);
-	int n = 0;
 
-	if (len > 1)
-		n = list ? scnprintf(buf, len, "%*pbl\n", nmaskbits, maskp) :
-			   scnprintf(buf, len, "%*pb\n", nmaskbits, maskp);
-	return n;
+	return list ? scnprintf(buf, len, "%*pbl\n", nmaskbits, maskp) :
+		      scnprintf(buf, len, "%*pb\n", nmaskbits, maskp);
 }
 EXPORT_SYMBOL(bitmap_print_to_pagebuf);
 
_

Patches currently in -mm which might be from linux@xxxxxxxxxxxxxxxxxx are





[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux