Skip to contentSkip to conversation

PowerPC-pSeries: Adjustments for dlpar_store()

PATCH Applied Markus Elfring 3 participants 6 messages Aug 27, 2019 – Feb 3, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover PowerPC-pSeries: Adjustments for dlpar_store()

From: Markus Elfring <[email protected]>
Date: Tue, 27 Aug 2019 14:33:21 +0200

Two update suggestions were taken into account
from static source code analysis.

Markus Elfring (2):
Delete an unnecessary kfree() call
Delete an error message for a failed string duplication

 arch/powerpc/platforms/pseries/dlpar.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--
2.23.0

#1 lore raw

PATCH 1/2 powerpc/pseries: Delete an unnecessary kfree() call in dlpar_store()

From: Markus Elfring <[email protected]>
Date: Tue, 27 Aug 2019 13:34:02 +0200

A null pointer would be passed to a call of the function “kfree” immediately after a call of the function “kstrdup” failed at one place. Remove this superfluous function call.

This issue was detected by using the Coccinelle software.

---
 arch/powerpc/platforms/pseries/dlpar.c | 1 -
 1 file changed, 1 deletion(-)
arch/powerpc/platforms/pseries/dlpar.c +0 -1
index 16e86ba8aa20..2a783dc0cfa7 100644
@@ -523,7 +523,6 @@ static ssize_t dlpar_store(struct class *class, struct class_attribute *attr,
 	args = argbuf = kstrdup(buf, GFP_KERNEL);
 	if (!argbuf) {
 		pr_info("Could not allocate resources for DLPAR operation\n");
-		kfree(argbuf);
 		return -ENOMEM;
 	}
 

--
2.23.0

#3 lore raw

PATCH 2/2 powerpc/pseries: Delete an error message for a failed string duplication in dlpar_store()

In reply to Markus Elfring

From: Markus Elfring <[email protected]>
Date: Tue, 27 Aug 2019 13:37:56 +0200

Omit an extra message for a memory allocation failure in this function.

---
 arch/powerpc/platforms/pseries/dlpar.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/powerpc/platforms/pseries/dlpar.c +1 -3
index 2a783dc0cfa7..deb48b41d488 100644
@@ -521,10 +521,8 @@ static ssize_t dlpar_store(struct class *class, struct class_attribute *attr,
 	int rc;
 
 	args = argbuf = kstrdup(buf, GFP_KERNEL);
-	if (!argbuf) {
-		pr_info("Could not allocate resources for DLPAR operation\n");
+	if (!argbuf)
 		return -ENOMEM;
-	}
 
 	/*
 	 * Parse out the request from the user, this will be in the form:

--
2.23.0

Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] powerpc/pseries: Delete an unnecessary kfree() call in dlpar_store()

In reply to Markus Elfring
Quoted 10 lines · Markus Elfring

From: Markus Elfring <[email protected]>
Date: Tue, 27 Aug 2019 13:34:02 +0200

A null pointer would be passed to a call of the function “kfree” immediately after a call of the function “kstrdup” failed at one place. Remove this superfluous function call.

This issue was detected by using the Coccinelle software.

#5 lore raw
In reply to Markus Elfring
Quoted 8 lines · Markus Elfring

Two update suggestions were taken into account
from static source code analysis.

Markus Elfring (2):
Delete an unnecessary kfree() call
Delete an error message for a failed string duplication

[...]

Applied to powerpc/next.

[1/2] powerpc/pseries: Delete an unnecessary kfree() call in dlpar_store()

      https://git.kernel.org/powerpc/c/de060ac83e5c1fe5fb8c505a4e99c1fe4f70ff94
[2/2] powerpc/pseries: Delete an error message for a failed string duplication in dlpar_store()
      https://git.kernel.org/powerpc/c/6e7a4da754f3087fa1f0839c1128aac233c21442

cheers