+ bitmap_parselist-dont-calculate-length-of-the-input-string.patch added to -mm tree

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

 



The patch titled
     Subject: lib: bitmap_parselist: don't calculate length of the input string
has been added to the -mm tree.  Its filename is
     bitmap_parselist-dont-calculate-length-of-the-input-string.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/bitmap_parselist-dont-calculate-length-of-the-input-string.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/bitmap_parselist-dont-calculate-length-of-the-input-string.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Yury Norov <yury.norov@xxxxxxxxx>
Subject: lib: bitmap_parselist: don't calculate length of the input string

Patch series "lib: rework bitmap_parselist and tests", v2.

bitmap_parselist has been evolved from a pretty simple idea for long and
now lacks for refactoring.  It is not structured, has nested loops and a
set of opaque-named variables.

Things are more complicated than they may be because bitmap_parselist() is
a part of user interface, and its behavior should not change.

In this patchset
 - __bitmap_parselist() is reworked (patches 2 and 3);
 - time measurement in test_bitmap_parselist switched to ktime_get
   (patch 4);
 - new tests introduced (patch 5), and
 - bitmap_parselist_user() testing enabled with the same testset as
   bitmap_parselist() (patch 6).

Patches 1 and 4 are fixes and may be applied separately.

v1: https://lkml.org/lkml/2018/12/23/50
v2: https://www.spinics.net/lists/kernel/msg3048976.html


This patch (of 6):

bitmap_parselist() calculates length of the input string before passing it
to the __bitmap_parselist().  But the end-of-line condition is checked for
every character in __bitmap_parselist() anyway.  So doing it in wrapper is
a simple waste of time.

Link: http://lkml.kernel.org/r/20190325210748.6571-2-ynorov@xxxxxxxxxxx
Signed-off-by: Yury Norov <ynorov@xxxxxxxxxxx>
Cc: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Cc: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
Cc: Arnd Bergmann <arnd@xxxxxxxx>
Cc: Kees Cook <keescook@xxxxxxxxxxxx>
Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx>
Cc: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 lib/bitmap.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--- a/lib/bitmap.c~bitmap_parselist-dont-calculate-length-of-the-input-string
+++ a/lib/bitmap.c
@@ -614,10 +614,7 @@ static int __bitmap_parselist(const char
 
 int bitmap_parselist(const char *bp, unsigned long *maskp, int nmaskbits)
 {
-	char *nl  = strchrnul(bp, '\n');
-	int len = nl - bp;
-
-	return __bitmap_parselist(bp, len, 0, maskp, nmaskbits);
+	return __bitmap_parselist(bp, UINT_MAX, 0, maskp, nmaskbits);
 }
 EXPORT_SYMBOL(bitmap_parselist);
 
_

Patches currently in -mm which might be from yury.norov@xxxxxxxxx are

bitmap_parselist-dont-calculate-length-of-the-input-string.patch
bitmap_parselist-move-non-parser-logic-to-helpers.patch
bitmap_parselist-rework-input-string-parser.patch
lib-test_bitmap-switch-test_bitmap_parselist-to-ktime_get.patch
lib-test_bitmap-add-testcases-for-bitmap_parselist.patch
lib-test_bitmap-add-tests-for-bitmap_parselist_user.patch




[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