+ mm-convert-sysfs-input-to-bool-using-kstrtobool.patch added to -mm tree

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

 



The patch titled
     Subject: mm: convert sysfs input to bool using kstrtobool()
has been added to the -mm tree.  Its filename is
     mm-convert-sysfs-input-to-bool-using-kstrtobool.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/mm-convert-sysfs-input-to-bool-using-kstrtobool.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/mm-convert-sysfs-input-to-bool-using-kstrtobool.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: Jagdish Gediya <jvgediya@xxxxxxxxxxxxx>
Subject: mm: convert sysfs input to bool using kstrtobool()

Sysfs input conversion to corrosponding bool value e.g.  "false" or "0" to
false, "true" or "1" to true are currently handled through strncmp at
multiple places.  Use kstrtobool() to convert sysfs input to bool value.

Link: https://lkml.kernel.org/r/20220426180203.70782-2-jvgediya@xxxxxxxxxxxxx
Signed-off-by: Jagdish Gediya <jvgediya@xxxxxxxxxxxxx>
Reviewed-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
Cc: Alexey Dobriyan <adobriyan@xxxxxxxxx>
Cc: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Cc: Dave Hansen <dave.hansen@xxxxxxxxx>
Cc: "Huang, Ying" <ying.huang@xxxxxxxxx>
Cc: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
Cc: Petr Mladek <pmladek@xxxxxxxx>
Cc: Richard Fitzgerald <rf@xxxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/migrate.c    |    6 +-----
 mm/swap_state.c |    6 +-----
 2 files changed, 2 insertions(+), 10 deletions(-)

--- a/mm/migrate.c~mm-convert-sysfs-input-to-bool-using-kstrtobool
+++ a/mm/migrate.c
@@ -2534,11 +2534,7 @@ static ssize_t numa_demotion_enabled_sto
 					   struct kobj_attribute *attr,
 					   const char *buf, size_t count)
 {
-	if (!strncmp(buf, "true", 4) || !strncmp(buf, "1", 1))
-		numa_demotion_enabled = true;
-	else if (!strncmp(buf, "false", 5) || !strncmp(buf, "0", 1))
-		numa_demotion_enabled = false;
-	else
+	if (kstrtobool(buf, &numa_demotion_enabled))
 		return -EINVAL;
 
 	return count;
--- a/mm/swap_state.c~mm-convert-sysfs-input-to-bool-using-kstrtobool
+++ a/mm/swap_state.c
@@ -874,11 +874,7 @@ static ssize_t vma_ra_enabled_store(stru
 				      struct kobj_attribute *attr,
 				      const char *buf, size_t count)
 {
-	if (!strncmp(buf, "true", 4) || !strncmp(buf, "1", 1))
-		enable_vma_readahead = true;
-	else if (!strncmp(buf, "false", 5) || !strncmp(buf, "0", 1))
-		enable_vma_readahead = false;
-	else
+	if (kstrtobool(buf, &enable_vma_readahead))
 		return -EINVAL;
 
 	return count;
_

Patches currently in -mm which might be from jvgediya@xxxxxxxxxxxxx are

lib-kstrtoxc-add-false-true-support-to-kstrtobool.patch
mm-convert-sysfs-input-to-bool-using-kstrtobool.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