linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] PowerPC-pSeries: Adjustments for dlpar_store()
@ 2019-08-27 12:40 Markus Elfring
  2019-08-27 12:42 ` [PATCH 1/2] powerpc/pseries: Delete an unnecessary kfree() call in dlpar_store() Markus Elfring
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Markus Elfring @ 2019-08-27 12:40 UTC (permalink / raw)
  To: linuxppc-dev, Allison Randal, Benjamin Herrenschmidt,
	Frank Rowand, Gen Zhang, Greg Kroah-Hartman, Michael Ellerman,
	Nathan Fontenot, Nathan Lynch, Oliver O'Halloran,
	Paul Mackerras, Thomas Gleixner
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] powerpc/pseries: Delete an unnecessary kfree() call in dlpar_store()
  2019-08-27 12:40 [PATCH 0/2] PowerPC-pSeries: Adjustments for dlpar_store() Markus Elfring
@ 2019-08-27 12:42 ` Markus Elfring
  2019-08-27 14:26   ` Nathan Lynch
  2019-08-27 12:44 ` [PATCH 2/2] powerpc/pseries: Delete an error message for a failed string duplication " Markus Elfring
  2021-02-03 11:40 ` [PATCH 0/2] PowerPC-pSeries: Adjustments for dlpar_store() Michael Ellerman
  2 siblings, 1 reply; 6+ messages in thread
From: Markus Elfring @ 2019-08-27 12:42 UTC (permalink / raw)
  To: linuxppc-dev, Allison Randal, Benjamin Herrenschmidt,
	Frank Rowand, Gen Zhang, Greg Kroah-Hartman, Michael Ellerman,
	Nathan Fontenot, Nathan Lynch, Oliver O'Halloran,
	Paul Mackerras, Thomas Gleixner
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] powerpc/pseries: Delete an error message for a failed string duplication in dlpar_store()
  2019-08-27 12:40 [PATCH 0/2] PowerPC-pSeries: Adjustments for dlpar_store() Markus Elfring
  2019-08-27 12:42 ` [PATCH 1/2] powerpc/pseries: Delete an unnecessary kfree() call in dlpar_store() Markus Elfring
@ 2019-08-27 12:44 ` Markus Elfring
  2019-08-27 14:27   ` Nathan Lynch
  2021-02-03 11:40 ` [PATCH 0/2] PowerPC-pSeries: Adjustments for dlpar_store() Michael Ellerman
  2 siblings, 1 reply; 6+ messages in thread
From: Markus Elfring @ 2019-08-27 12:44 UTC (permalink / raw)
  To: linuxppc-dev, Allison Randal, Benjamin Herrenschmidt,
	Frank Rowand, Gen Zhang, Greg Kroah-Hartman, Michael Ellerman,
	Nathan Fontenot, Nathan Lynch, Oliver O'Halloran,
	Paul Mackerras, Thomas Gleixner
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] powerpc/pseries: Delete an unnecessary kfree() call in dlpar_store()
  2019-08-27 12:42 ` [PATCH 1/2] powerpc/pseries: Delete an unnecessary kfree() call in dlpar_store() Markus Elfring
@ 2019-08-27 14:26   ` Nathan Lynch
  0 siblings, 0 replies; 6+ messages in thread
From: Nathan Lynch @ 2019-08-27 14:26 UTC (permalink / raw)
  To: Markus Elfring
  Cc: LKML, kernel-janitors, linuxppc-dev, Allison Randal,
	Benjamin Herrenschmidt, Frank Rowand, Gen Zhang,
	Greg Kroah-Hartman, Michael Ellerman, Oliver O'Halloran,
	Paul Mackerras, Thomas Gleixner

Markus Elfring <Markus.Elfring@web.de> writes:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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 <elfring@users.sourceforge.net>

Acked-by: Nathan Lynch <nathanl@linux.ibm.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] powerpc/pseries: Delete an error message for a failed string duplication in dlpar_store()
  2019-08-27 12:44 ` [PATCH 2/2] powerpc/pseries: Delete an error message for a failed string duplication " Markus Elfring
@ 2019-08-27 14:27   ` Nathan Lynch
  0 siblings, 0 replies; 6+ messages in thread
From: Nathan Lynch @ 2019-08-27 14:27 UTC (permalink / raw)
  To: Markus Elfring
  Cc: LKML, kernel-janitors, linuxppc-dev, Allison Randal,
	Benjamin Herrenschmidt, Frank Rowand, Gen Zhang,
	Greg Kroah-Hartman, Michael Ellerman, Oliver O'Halloran,
	Paul Mackerras, Thomas Gleixner

Markus Elfring <Markus.Elfring@web.de> writes:

> From: Markus Elfring <elfring@users.sourceforge.net>
> 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 <elfring@users.sourceforge.net>

Acked-by: Nathan Lynch <nathanl@linux.ibm.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] PowerPC-pSeries: Adjustments for dlpar_store()
  2019-08-27 12:40 [PATCH 0/2] PowerPC-pSeries: Adjustments for dlpar_store() Markus Elfring
  2019-08-27 12:42 ` [PATCH 1/2] powerpc/pseries: Delete an unnecessary kfree() call in dlpar_store() Markus Elfring
  2019-08-27 12:44 ` [PATCH 2/2] powerpc/pseries: Delete an error message for a failed string duplication " Markus Elfring
@ 2021-02-03 11:40 ` Michael Ellerman
  2 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2021-02-03 11:40 UTC (permalink / raw)
  To: linuxppc-dev, Benjamin Herrenschmidt, Frank Rowand,
	Michael Ellerman, Allison Randal, Markus Elfring,
	Oliver O'Halloran, Nathan Lynch, Greg Kroah-Hartman,
	Paul Mackerras, Gen Zhang, Nathan Fontenot, Thomas Gleixner
  Cc: LKML, kernel-janitors

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-02-03 11:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-27 12:40 [PATCH 0/2] PowerPC-pSeries: Adjustments for dlpar_store() Markus Elfring
2019-08-27 12:42 ` [PATCH 1/2] powerpc/pseries: Delete an unnecessary kfree() call in dlpar_store() Markus Elfring
2019-08-27 14:26   ` Nathan Lynch
2019-08-27 12:44 ` [PATCH 2/2] powerpc/pseries: Delete an error message for a failed string duplication " Markus Elfring
2019-08-27 14:27   ` Nathan Lynch
2021-02-03 11:40 ` [PATCH 0/2] PowerPC-pSeries: Adjustments for dlpar_store() Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).