lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220620104123.341054-3-clement.leger@bootlin.com>
Date:   Mon, 20 Jun 2022 12:41:20 +0200
From:   Clément Léger <clement.leger@...tlin.com>
To:     Michael Ellerman <mpe@...erman.id.au>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Paul Mackerras <paulus@...ba.org>,
        Rob Herring <robh+dt@...nel.org>,
        Frank Rowand <frowand.list@...il.com>,
        Nathan Lynch <nathanl@...ux.ibm.com>,
        Laurent Dufour <ldufour@...ux.ibm.com>,
        Daniel Henrique Barboza <danielhb413@...il.com>,
        David Gibson <david@...son.dropbear.id.au>,
        Andrew Morton <akpm@...ux-foundation.org>,
        David Hildenbrand <david@...hat.com>,
        Ohhoon Kwon <ohoono.kwon@...sung.com>,
        "Aneesh Kumar K.V" <aneesh.kumar@...ux.ibm.com>,
        YueHaibing <yuehaibing@...wei.com>
Cc:     Clément Léger <clement.leger@...tlin.com>,
        linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
        devicetree@...r.kernel.org,
        Allan Nielsen <allan.nielsen@...rochip.com>,
        Horatiu Vultur <horatiu.vultur@...rochip.com>,
        Steen Hegelund <steen.hegelund@...rochip.com>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
        Bjorn Helgaas <helgaas@...nel.org>,
        Lizhi Hou <lizhi.hou@...inx.com>
Subject: [PATCH v3 2/5] of: remove __of_node_dup() allocflags parameter

The alloclags are always set to GFP_KERNEL so remove this specific flag.
Moreover, this function is going to be based on one that does not
provides passing gfp flags, so be prepared for this.

Signed-off-by: Clément Léger <clement.leger@...tlin.com>
---
 drivers/of/dynamic.c    |  9 ++++-----
 drivers/of/of_private.h |  2 +-
 drivers/of/overlay.c    |  2 +-
 drivers/of/unittest.c   | 16 ++++++++--------
 4 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index cd3821a6444f..5560e501aedf 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -369,7 +369,6 @@ void of_node_release(struct kobject *kobj)
 /**
  * __of_prop_dup - Copy a property dynamically.
  * @prop:	Property to copy
- * @allocflags:	Allocation flags (typically pass GFP_KERNEL)
  *
  * Copy a property by dynamically allocating the memory of both the
  * property structure and the property name & contents. The property's
@@ -378,11 +377,11 @@ void of_node_release(struct kobject *kobj)
  *
  * Return: The newly allocated property or NULL on out of memory error.
  */
-struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags)
+struct property *__of_prop_dup(const struct property *prop)
 {
 	struct property *new;
 
-	new = kzalloc(sizeof(*new), allocflags);
+	new = kzalloc(sizeof(*new), GFP_KERNEL);
 	if (!new)
 		return NULL;
 
@@ -392,8 +391,8 @@ struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags)
 	 * of zero bytes. We do this to work around the use
 	 * of of_get_property() calls on boolean values.
 	 */
-	new->name = kstrdup(prop->name, allocflags);
-	new->value = kmemdup(prop->value, prop->length, allocflags);
+	new->name = kstrdup(prop->name, GFP_KERNEL);
+	new->value = kmemdup(prop->value, prop->length, GFP_KERNEL);
 	new->length = prop->length;
 	if (!new->name || !new->value)
 		goto err_free;
diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h
index 9324483397f6..e319d8c2bf8b 100644
--- a/drivers/of/of_private.h
+++ b/drivers/of/of_private.h
@@ -115,7 +115,7 @@ extern void *__unflatten_device_tree(const void *blob,
  * without taking node references, so you either have to
  * own the devtree lock or work on detached trees only.
  */
-struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags);
+struct property *__of_prop_dup(const struct property *prop);
 struct device_node *__of_node_dup(const struct device_node *np,
 				  const char *full_name);
 
diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index 4044ddcb02c6..9c026bcbf6ab 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -339,7 +339,7 @@ static int add_changeset_property(struct overlay_changeset *ovcs,
 			return -EINVAL;
 		new_prop = dup_and_fixup_symbol_prop(ovcs, overlay_prop);
 	} else {
-		new_prop = __of_prop_dup(overlay_prop, GFP_KERNEL);
+		new_prop = __of_prop_dup(overlay_prop);
 	}
 
 	if (!new_prop)
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 7f6bba18c515..23ccb74ef408 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -772,13 +772,13 @@ static void __init of_unittest_property_copy(void)
 	struct property p2 = { .name = "p2", .length = 5, .value = "abcd" };
 	struct property *new;
 
-	new = __of_prop_dup(&p1, GFP_KERNEL);
+	new = __of_prop_dup(&p1);
 	unittest(new && propcmp(&p1, new), "empty property didn't copy correctly\n");
 	kfree(new->value);
 	kfree(new->name);
 	kfree(new);
 
-	new = __of_prop_dup(&p2, GFP_KERNEL);
+	new = __of_prop_dup(&p2);
 	unittest(new && propcmp(&p2, new), "non-empty property didn't copy correctly\n");
 	kfree(new->value);
 	kfree(new->name);
@@ -811,19 +811,19 @@ static void __init of_unittest_changeset(void)
 	nremove = of_get_child_by_name(nchangeset, "node-remove");
 	unittest(nremove, "testcase setup failure\n");
 
-	ppadd = __of_prop_dup(&padd, GFP_KERNEL);
+	ppadd = __of_prop_dup(&padd);
 	unittest(ppadd, "testcase setup failure\n");
 
-	ppname_n1  = __of_prop_dup(&pname_n1, GFP_KERNEL);
+	ppname_n1  = __of_prop_dup(&pname_n1);
 	unittest(ppname_n1, "testcase setup failure\n");
 
-	ppname_n2  = __of_prop_dup(&pname_n2, GFP_KERNEL);
+	ppname_n2  = __of_prop_dup(&pname_n2);
 	unittest(ppname_n2, "testcase setup failure\n");
 
-	ppname_n21 = __of_prop_dup(&pname_n21, GFP_KERNEL);
+	ppname_n21 = __of_prop_dup(&pname_n21);
 	unittest(ppname_n21, "testcase setup failure\n");
 
-	ppupdate = __of_prop_dup(&pupdate, GFP_KERNEL);
+	ppupdate = __of_prop_dup(&pupdate);
 	unittest(ppupdate, "testcase setup failure\n");
 
 	parent = nchangeset;
@@ -3333,7 +3333,7 @@ static __init void of_unittest_overlay_high_level(void)
 		struct property *new_prop;
 		for_each_property_of_node(overlay_base_symbols, prop) {
 
-			new_prop = __of_prop_dup(prop, GFP_KERNEL);
+			new_prop = __of_prop_dup(prop);
 			if (!new_prop) {
 				unittest(0, "__of_prop_dup() of '%s' from overlay_base node __symbols__",
 					 prop->name);
-- 
2.36.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ