projects
/
platform
/
kernel
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
30705cd
)
serial: smh: Check return value of strndup
author
Sean Anderson
<sean.anderson@seco.com>
Fri, 22 Apr 2022 18:50:23 +0000
(14:50 -0400)
committer
Tom Rini
<trini@konsulko.com>
Thu, 5 May 2022 19:06:02 +0000
(15:06 -0400)
strndup can fail. Check for it.
Fixes:
4855b39be
("serial: smh: Implement puts for DM")
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
drivers/serial/serial_semihosting.c
patch
|
blob
|
history
diff --git
a/drivers/serial/serial_semihosting.c
b/drivers/serial/serial_semihosting.c
index
4328b3d
..
2561414
100644
(file)
--- a/
drivers/serial/serial_semihosting.c
+++ b/
drivers/serial/serial_semihosting.c
@@
-54,6
+54,9
@@
static ssize_t smh_serial_puts(struct udevice *dev, const char *s, size_t len)
}
buf = strndup(s, len);
}
buf = strndup(s, len);
+ if (!buf)
+ return -ENOMEM;
+
smh_puts(buf);
free(buf);
return len;
smh_puts(buf);
free(buf);
return len;