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
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.
Signed-off-by: Markus Elfring <[email protected]>
---
arch/powerpc/platforms/pseries/dlpar.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index 16e86ba8aa20..2a783dc0cfa7 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -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
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.
Signed-off-by: Markus Elfring <[email protected]>
---
arch/powerpc/platforms/pseries/dlpar.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index 2a783dc0cfa7..deb48b41d488 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -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
Markus Elfring <[email protected]> writes:
> 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.
>
> Signed-off-by: Markus Elfring <[email protected]>
Acked-by: Nathan Lynch <[email protected]>
Markus Elfring <[email protected]> writes:
> 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.
>
> Signed-off-by: Markus Elfring <[email protected]>
Acked-by: Nathan Lynch <[email protected]>
On Tue, 27 Aug 2019 14:40:42 +0200, Markus Elfring wrote:
> 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