Skip to contentSkip to conversation

mm-convert-sysfs-input-to-bool-using-kstrtobool.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message May 13, 2022

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: convert sysfs input to bool using kstrtobool()
has been removed from the -mm tree. Its filename was
mm-convert-sysfs-input-to-bool-using-kstrtobool.patch

This patch was dropped because it was merged into the mm-stable branch\nof git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Jagdish Gediya <[email protected]>
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.

[[email protected]: propagate kstrtobool() return value, per Andy]
Cc Alexey Dobriyan <[email protected]>
Cc Dave Hansen <[email protected]>
Cc "Huang, Ying" <[email protected]>
Cc Jonathan Cameron <[email protected]>
Cc Petr Mladek <[email protected]>
Cc Richard Fitzgerald <[email protected]>

---

 mm/migrate.c    |   11 +++++------
 mm/swap_state.c |   11 +++++------
 2 files changed, 10 insertions(+), 12 deletions(-)
mm/migrate.c renamed from mm/migrate.c~mm-convert-sysfs-input-to-bool-using-kstrtobool +5 -6
@@ -2523,12 +2523,11 @@ 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
-		return -EINVAL;
+	ssize_t ret;
+
+	ret = kstrtobool(buf, &numa_demotion_enabled);
+	if (ret)
+		return ret;
 
 	return count;
 }
mm/swap_state.c renamed from mm/swap_state.c~mm-convert-sysfs-input-to-bool-using-kstrtobool +5 -6
@@ -874,12 +874,11 @@ 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
-		return -EINVAL;
+	ssize_t ret;
+
+	ret = kstrtobool(buf, &enable_vma_readahead);
+	if (ret)
+		return ret;
 
 	return count;
 }

_

Patches currently in -mm which might be from [email protected] are