PowerPC-pSeries: Adjustments for dlpar_store()
Subsystems (2)
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
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
@@ -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
PATCH 2/2 powerpc/pseries: Delete an error message for a failed string duplication in dlpar_store()
In reply to Markus ElfringFrom: 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
@@ -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
Re: [PATCH 1/2] powerpc/pseries: Delete an unnecessary kfree() call in dlpar_store()
In reply to Markus ElfringQuoted 10 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Tue, 27 Aug 2019 13:34:02 +0200A 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.
Signed-off-by Markus Elfring <[email protected]>
Re: [PATCH 2/2] powerpc/pseries: Delete an error message for a failed string duplication in dlpar_store()
In reply to Markus ElfringQuoted 6 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Tue, 27 Aug 2019 13:37:56 +0200Omit an extra message for a memory allocation failure in this function.
Signed-off-by Markus Elfring <[email protected]>
Michael Ellerman
AppliedQuoted 8 lines · Markus Elfring
Two update suggestions were taken into account
from static source code analysis.Markus Elfring (2):
Delete an unnecessarykfree()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