+ cpumask-fix-double-string-traverse-in-cpumask_parse.patch added to -mm tree

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

 



The patch titled
     Subject: include/linux/cpumask.h: fix double string traverse in cpumask_parse
has been added to the -mm tree.  Its filename is
     cpumask-fix-double-string-traverse-in-cpumask_parse.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/cpumask-fix-double-string-traverse-in-cpumask_parse.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/cpumask-fix-double-string-traverse-in-cpumask_parse.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 <ynorov@xxxxxxxxxxx>
Subject: include/linux/cpumask.h: fix double string traverse in cpumask_parse

cpumask_parse() finds first occurrence of either or strchr() and strlen().
We can do it better with a single call of strchrnul().

Link: http://lkml.kernel.org/r/20190409204208.12190-1-ynorov@xxxxxxxxxxx
Signed-off-by: Yury Norov <ynorov@xxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 include/linux/cpumask.h |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/include/linux/cpumask.h~cpumask-fix-double-string-traverse-in-cpumask_parse
+++ a/include/linux/cpumask.h
@@ -633,8 +633,7 @@ static inline int cpumask_parselist_user
  */
 static inline int cpumask_parse(const char *buf, struct cpumask *dstp)
 {
-	char *nl = strchr(buf, '\n');
-	unsigned int len = nl ? (unsigned int)(nl - buf) : strlen(buf);
+	unsigned int len = (unsigned int)(strchrnul(buf, '\n') - buf);
 
 	return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpumask_bits);
 }
_

Patches currently in -mm which might be from ynorov@xxxxxxxxxxx are

cpumask-fix-double-string-traverse-in-cpumask_parse.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