git.openpandora.org
/
pandora-u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
riscv: add NULL check before calling strlen in the riscv cpu's get_desc()
[pandora-u-boot.git]
/
drivers
/
cpu
/
riscv_cpu.c
diff --git
a/drivers/cpu/riscv_cpu.c
b/drivers/cpu/riscv_cpu.c
index
4f2958a
..
4fff465
100644
(file)
--- a/
drivers/cpu/riscv_cpu.c
+++ b/
drivers/cpu/riscv_cpu.c
@@
-23,7
+23,7
@@
static int riscv_cpu_get_desc(const struct udevice *dev, char *buf, int size)
const char *cpu;
cpu = dev_read_string(dev, "compatible");
- if (size < (strlen(cpu) + 1))
+ if (
!cpu ||
size < (strlen(cpu) + 1))
return -ENOSPC;
strcpy(buf, cpu);