All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: u300: add missing check for kmalloc
@ 2018-08-24 10:28 ` Nicholas Mc Guire
  0 siblings, 0 replies; 10+ messages in thread
From: Nicholas Mc Guire @ 2018-08-24 10:28 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Russell King, linux-arm-kernel, linux-kernel, Nicholas Mc Guire

 kmalloc return for bigrxbuf_virtual was not being checked - in case
of failure set status, cleanup bigtxbuf_virtual and baile out.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: c7c8c78fdf6e ("ARM: 5667/3: U300 SSP/SPI board setup and test")
---

Issue found with experimental coccinelle script

Not sure about the checkpatch message: 
CHECK: Comparison to NULL could be written "!bigrxbuf_virtual"
#32: FILE: arch/arm/mach-u300/dummyspichip.c:67:
+       if (bigrxbuf_virtual == NULL) {
As the current check for bigtxbuf_virtual uses == NULL that 
was retained for consistency here.

Patch was compile tested with: u300_defconfig (implies MACH_U300_SPIDUMMY=y)

Patch is against 4.18 (localversion-next is next-20180824)

 arch/arm/mach-u300/dummyspichip.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/mach-u300/dummyspichip.c b/arch/arm/mach-u300/dummyspichip.c
index 68fe986..ff293ee 100644
--- a/arch/arm/mach-u300/dummyspichip.c
+++ b/arch/arm/mach-u300/dummyspichip.c
@@ -62,7 +62,13 @@ static ssize_t dummy_looptest(struct device *dev,
 		status = -ENOMEM;
 		goto out;
 	}
+
 	bigrxbuf_virtual = kmalloc(DMA_TEST_SIZE, GFP_KERNEL);
+	if (bigrxbuf_virtual == NULL) {
+		kfree(bigtxbuf_virtual);
+		status = -ENOMEM;
+		goto out;
+	}
 
 	/* Fill TXBUF with some happy pattern */
 	memset(bigtxbuf_virtual, 0xAA, DMA_TEST_SIZE);
-- 
2.1.4


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

* [PATCH] ARM: u300: add missing check for kmalloc
@ 2018-08-24 10:28 ` Nicholas Mc Guire
  0 siblings, 0 replies; 10+ messages in thread
From: Nicholas Mc Guire @ 2018-08-24 10:28 UTC (permalink / raw)
  To: linux-arm-kernel

 kmalloc return for bigrxbuf_virtual was not being checked - in case
of failure set status, cleanup bigtxbuf_virtual and baile out.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: c7c8c78fdf6e ("ARM: 5667/3: U300 SSP/SPI board setup and test")
---

Issue found with experimental coccinelle script

Not sure about the checkpatch message: 
CHECK: Comparison to NULL could be written "!bigrxbuf_virtual"
#32: FILE: arch/arm/mach-u300/dummyspichip.c:67:
+       if (bigrxbuf_virtual == NULL) {
As the current check for bigtxbuf_virtual uses == NULL that 
was retained for consistency here.

Patch was compile tested with: u300_defconfig (implies MACH_U300_SPIDUMMY=y)

Patch is against 4.18 (localversion-next is next-20180824)

 arch/arm/mach-u300/dummyspichip.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/mach-u300/dummyspichip.c b/arch/arm/mach-u300/dummyspichip.c
index 68fe986..ff293ee 100644
--- a/arch/arm/mach-u300/dummyspichip.c
+++ b/arch/arm/mach-u300/dummyspichip.c
@@ -62,7 +62,13 @@ static ssize_t dummy_looptest(struct device *dev,
 		status = -ENOMEM;
 		goto out;
 	}
+
 	bigrxbuf_virtual = kmalloc(DMA_TEST_SIZE, GFP_KERNEL);
+	if (bigrxbuf_virtual == NULL) {
+		kfree(bigtxbuf_virtual);
+		status = -ENOMEM;
+		goto out;
+	}
 
 	/* Fill TXBUF with some happy pattern */
 	memset(bigtxbuf_virtual, 0xAA, DMA_TEST_SIZE);
-- 
2.1.4

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

* Re: [PATCH] ARM: u300: add missing check for kmalloc
  2018-08-24 10:28 ` Nicholas Mc Guire
@ 2018-09-05  9:09   ` Linus Walleij
  -1 siblings, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2018-09-05  9:09 UTC (permalink / raw)
  To: Nicholas Mc Guire; +Cc: Russell King, Linux ARM, linux-kernel

On Fri, Aug 24, 2018 at 12:33 PM Nicholas Mc Guire <hofrat@osadl.org> wrote:

>  kmalloc return for bigrxbuf_virtual was not being checked - in case
> of failure set status, cleanup bigtxbuf_virtual and baile out.
>
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> Fixes: c7c8c78fdf6e ("ARM: 5667/3: U300 SSP/SPI board setup and test")

I will delete this testchip instead. It is not in use.

Yours,
Linus Walleij

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

* [PATCH] ARM: u300: add missing check for kmalloc
@ 2018-09-05  9:09   ` Linus Walleij
  0 siblings, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2018-09-05  9:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Aug 24, 2018 at 12:33 PM Nicholas Mc Guire <hofrat@osadl.org> wrote:

>  kmalloc return for bigrxbuf_virtual was not being checked - in case
> of failure set status, cleanup bigtxbuf_virtual and baile out.
>
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> Fixes: c7c8c78fdf6e ("ARM: 5667/3: U300 SSP/SPI board setup and test")

I will delete this testchip instead. It is not in use.

Yours,
Linus Walleij

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

* Re: [PATCH] ARM: u300: add missing check for kmalloc
  2018-09-05  9:09   ` Linus Walleij
@ 2018-09-05 11:20     ` Nicholas Mc Guire
  -1 siblings, 0 replies; 10+ messages in thread
From: Nicholas Mc Guire @ 2018-09-05 11:20 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Nicholas Mc Guire, Russell King, Linux ARM, linux-kernel

On Wed, Sep 05, 2018 at 11:09:21AM +0200, Linus Walleij wrote:
> On Fri, Aug 24, 2018 at 12:33 PM Nicholas Mc Guire <hofrat@osadl.org> wrote:
> 
> >  kmalloc return for bigrxbuf_virtual was not being checked - in case
> > of failure set status, cleanup bigtxbuf_virtual and baile out.
> >
> > Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> > Fixes: c7c8c78fdf6e ("ARM: 5667/3: U300 SSP/SPI board setup and test")
> 
> I will delete this testchip instead. It is not in use.
>
well that will for sure eliminate this bug reliably ;)

thx!
hofrat 

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

* [PATCH] ARM: u300: add missing check for kmalloc
@ 2018-09-05 11:20     ` Nicholas Mc Guire
  0 siblings, 0 replies; 10+ messages in thread
From: Nicholas Mc Guire @ 2018-09-05 11:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Sep 05, 2018 at 11:09:21AM +0200, Linus Walleij wrote:
> On Fri, Aug 24, 2018 at 12:33 PM Nicholas Mc Guire <hofrat@osadl.org> wrote:
> 
> >  kmalloc return for bigrxbuf_virtual was not being checked - in case
> > of failure set status, cleanup bigtxbuf_virtual and baile out.
> >
> > Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> > Fixes: c7c8c78fdf6e ("ARM: 5667/3: U300 SSP/SPI board setup and test")
> 
> I will delete this testchip instead. It is not in use.
>
well that will for sure eliminate this bug reliably ;)

thx!
hofrat 

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

* Re: [PATCH] ARM: u300: add missing check for kmalloc
  2019-04-13  7:14   ` Nicholas Mc Guire
@ 2019-04-23 10:26     ` Linus Walleij
  -1 siblings, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2019-04-23 10:26 UTC (permalink / raw)
  To: Nicholas Mc Guire
  Cc: Russell King, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, NXP Linux Team, Mark Brown, Tony Lindgren,
	Mike Rapoport, Janusz Krzysztofik, Linux ARM, linux-kernel

Hi Nicholas,

thanks for your patch!

On Sat, Apr 13, 2019 at 9:20 AM Nicholas Mc Guire <hofrat@osadl.org> wrote:

>  kmalloc return for bigrxbuf_virtual was not being checked - in case
> of failure set status, cleanup bigtxbuf_virtual and baile out.
>
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> Fixes: c7c8c78fdf6e ("ARM: 5667/3: U300 SSP/SPI board setup and test")

This code is deleted from the kernel and the code had
zero users before that, so no need to fix it! Sorry for your
trouble!

Yours,
Linus Walleij

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

* Re: [PATCH] ARM: u300: add missing check for kmalloc
@ 2019-04-23 10:26     ` Linus Walleij
  0 siblings, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2019-04-23 10:26 UTC (permalink / raw)
  To: Nicholas Mc Guire
  Cc: Mike Rapoport, Tony Lindgren, Shawn Guo, Sascha Hauer,
	Janusz Krzysztofik, Russell King, linux-kernel, Mark Brown,
	NXP Linux Team, Pengutronix Kernel Team, Fabio Estevam,
	Linux ARM

Hi Nicholas,

thanks for your patch!

On Sat, Apr 13, 2019 at 9:20 AM Nicholas Mc Guire <hofrat@osadl.org> wrote:

>  kmalloc return for bigrxbuf_virtual was not being checked - in case
> of failure set status, cleanup bigtxbuf_virtual and baile out.
>
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> Fixes: c7c8c78fdf6e ("ARM: 5667/3: U300 SSP/SPI board setup and test")

This code is deleted from the kernel and the code had
zero users before that, so no need to fix it! Sorry for your
trouble!

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH] ARM: u300: add missing check for kmalloc
  2019-04-13  7:14 [PATCH 0/4] ARM: imx legacy: cleanups Nicholas Mc Guire
@ 2019-04-13  7:14   ` Nicholas Mc Guire
  0 siblings, 0 replies; 10+ messages in thread
From: Nicholas Mc Guire @ 2019-04-13  7:14 UTC (permalink / raw)
  To: Russell King
  Cc: Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Mark Brown, Linus Walleij, Tony Lindgren,
	Mike Rapoport, Janusz Krzysztofik, linux-arm-kernel,
	linux-kernel, Nicholas Mc Guire

 kmalloc return for bigrxbuf_virtual was not being checked - in case
of failure set status, cleanup bigtxbuf_virtual and baile out.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: c7c8c78fdf6e ("ARM: 5667/3: U300 SSP/SPI board setup and test")
---

Issue found with experimental coccinelle script

Not sure about the checkpatch message: 
CHECK: Comparison to NULL could be written "!bigrxbuf_virtual"
#32: FILE: arch/arm/mach-u300/dummyspichip.c:67:
+       if (bigrxbuf_virtual == NULL) {
As the current check for bigtxbuf_virtual uses == NULL that 
was retained for consistency here.

Patch was compile tested with: u300_defconfig (implies MACH_U300_SPIDUMMY=y)

Patch is against 4.18 (localversion-next is next-20180824)

 arch/arm/mach-u300/dummyspichip.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/mach-u300/dummyspichip.c b/arch/arm/mach-u300/dummyspichip.c
index 68fe986..ff293ee 100644
--- a/arch/arm/mach-u300/dummyspichip.c
+++ b/arch/arm/mach-u300/dummyspichip.c
@@ -62,7 +62,13 @@ static ssize_t dummy_looptest(struct device *dev,
 		status = -ENOMEM;
 		goto out;
 	}
+
 	bigrxbuf_virtual = kmalloc(DMA_TEST_SIZE, GFP_KERNEL);
+	if (bigrxbuf_virtual == NULL) {
+		kfree(bigtxbuf_virtual);
+		status = -ENOMEM;
+		goto out;
+	}
 
 	/* Fill TXBUF with some happy pattern */
 	memset(bigtxbuf_virtual, 0xAA, DMA_TEST_SIZE);
-- 
2.1.4


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

* [PATCH] ARM: u300: add missing check for kmalloc
@ 2019-04-13  7:14   ` Nicholas Mc Guire
  0 siblings, 0 replies; 10+ messages in thread
From: Nicholas Mc Guire @ 2019-04-13  7:14 UTC (permalink / raw)
  To: Russell King
  Cc: Mike Rapoport, Tony Lindgren, Shawn Guo, Sascha Hauer,
	Janusz Krzysztofik, linux-kernel, Mark Brown, NXP Linux Team,
	Pengutronix Kernel Team, Nicholas Mc Guire, Fabio Estevam,
	Linus Walleij, linux-arm-kernel

 kmalloc return for bigrxbuf_virtual was not being checked - in case
of failure set status, cleanup bigtxbuf_virtual and baile out.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: c7c8c78fdf6e ("ARM: 5667/3: U300 SSP/SPI board setup and test")
---

Issue found with experimental coccinelle script

Not sure about the checkpatch message: 
CHECK: Comparison to NULL could be written "!bigrxbuf_virtual"
#32: FILE: arch/arm/mach-u300/dummyspichip.c:67:
+       if (bigrxbuf_virtual == NULL) {
As the current check for bigtxbuf_virtual uses == NULL that 
was retained for consistency here.

Patch was compile tested with: u300_defconfig (implies MACH_U300_SPIDUMMY=y)

Patch is against 4.18 (localversion-next is next-20180824)

 arch/arm/mach-u300/dummyspichip.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/mach-u300/dummyspichip.c b/arch/arm/mach-u300/dummyspichip.c
index 68fe986..ff293ee 100644
--- a/arch/arm/mach-u300/dummyspichip.c
+++ b/arch/arm/mach-u300/dummyspichip.c
@@ -62,7 +62,13 @@ static ssize_t dummy_looptest(struct device *dev,
 		status = -ENOMEM;
 		goto out;
 	}
+
 	bigrxbuf_virtual = kmalloc(DMA_TEST_SIZE, GFP_KERNEL);
+	if (bigrxbuf_virtual == NULL) {
+		kfree(bigtxbuf_virtual);
+		status = -ENOMEM;
+		goto out;
+	}
 
 	/* Fill TXBUF with some happy pattern */
 	memset(bigtxbuf_virtual, 0xAA, DMA_TEST_SIZE);
-- 
2.1.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2019-04-23 10:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-24 10:28 [PATCH] ARM: u300: add missing check for kmalloc Nicholas Mc Guire
2018-08-24 10:28 ` Nicholas Mc Guire
2018-09-05  9:09 ` Linus Walleij
2018-09-05  9:09   ` Linus Walleij
2018-09-05 11:20   ` Nicholas Mc Guire
2018-09-05 11:20     ` Nicholas Mc Guire
2019-04-13  7:14 [PATCH 0/4] ARM: imx legacy: cleanups Nicholas Mc Guire
2019-04-13  7:14 ` [PATCH] ARM: u300: add missing check for kmalloc Nicholas Mc Guire
2019-04-13  7:14   ` Nicholas Mc Guire
2019-04-23 10:26   ` Linus Walleij
2019-04-23 10:26     ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.