mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 15:14:43 +00:00
serial: smh: Check return value of strndup
strndup can fail. Check for it. Fixes: 4855b39be ("serial: smh: Implement puts for DM") Signed-off-by: Sean Anderson <sean.anderson@seco.com>
This commit is contained in:
parent
30705cd892
commit
bfae2744dd
1 changed files with 3 additions and 0 deletions
|
@ -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);
|
smh_puts(buf);
|
||||||
free(buf);
|
free(buf);
|
||||||
return len;
|
return len;
|
||||||
|
|
Loading…
Reference in a new issue