public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] cmd: spi: check return value of strdup
@ 2016-03-20 13:21 Peng Fan
  2016-03-27 22:28 ` [U-Boot] " Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Peng Fan @ 2016-03-20 13:21 UTC (permalink / raw)
  To: u-boot

Check return value of strdup.

Signed-off-by: Peng Fan <van.freenix@gmail.com>
Cc: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefan Roese <sr@denx.de>
Cc: Tom Rini <trini@konsulko.com>
---
 cmd/spi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/cmd/spi.c b/cmd/spi.c
index 64c3ffc..f16ef9a 100644
--- a/cmd/spi.c
+++ b/cmd/spi.c
@@ -51,6 +51,8 @@ static int do_spi_xfer(int bus, int cs)
 
 	snprintf(name, sizeof(name), "generic_%d:%d", bus, cs);
 	str = strdup(name);
+	if (!str)
+		return -ENOMEM;
 	ret = spi_get_bus_and_cs(bus, cs, 1000000, mode, "spi_generic_drv",
 				 str, &dev, &slave);
 	if (ret)
-- 
2.6.2

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

* [U-Boot] cmd: spi: check return value of strdup
  2016-03-20 13:21 [U-Boot] [PATCH] cmd: spi: check return value of strdup Peng Fan
@ 2016-03-27 22:28 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2016-03-27 22:28 UTC (permalink / raw)
  To: u-boot

On Sun, Mar 20, 2016 at 09:21:36PM +0800, Peng Fan wrote:

> Check return value of strdup.
> 
> Signed-off-by: Peng Fan <van.freenix@gmail.com>
> Cc: Przemyslaw Marczak <p.marczak@samsung.com>
> Cc: Bin Meng <bmeng.cn@gmail.com>
> Cc: Heiko Schocher <hs@denx.de>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Stefan Roese <sr@denx.de>
> Cc: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160327/b73bf0f5/attachment.sig>

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

end of thread, other threads:[~2016-03-27 22:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-20 13:21 [U-Boot] [PATCH] cmd: spi: check return value of strdup Peng Fan
2016-03-27 22:28 ` [U-Boot] " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox