cmd: spi: check return value of strdup
PATCH 1/1 cmd: spi: check return value of strdup
Check return value of strdup.
Signed-off-by Peng Fan <[email protected]>
Cc Przemyslaw Marczak <[email protected]>
Cc Bin Meng <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Simon Glass <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
--- cmd/spi.c | 2 ++ 1 file changed, 2 insertions(+)
cmd/spi.c +2 -0
@@ -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)
Signature · 1 line
2.6.2
Quoted 9 lines · Peng Fan
Check return value of strdup.
Signed-off-by Peng Fan <[email protected]>Cc Przemyslaw Marczak <[email protected]>Cc Bin Meng <[email protected]>Cc Heiko Schocher <[email protected]>Cc Simon Glass <[email protected]>Cc Stefan Roese <[email protected]>Cc Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
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>