summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2023-02-28 11:44:31 +0400
committerDavid Gibson <david@gibson.dropbear.id.au>2023-03-01 15:56:29 +1100
commitee5799938697db66ed93bbb0e474d389de58185d (patch)
tree44c65800af9e909b5debe8c0e88df4e52fff8c8b
parent44c9b73801c1e02e95b533a3cb498ab8c532e98b (diff)
downloaddevice-tree-compiler-ee5799938697db66ed93bbb0e474d389de58185d.tar.gz
checks.c: fix heap-buffer-overflow
./dtc -I dts -O dtb -o aliases.dtb /home/elmarco/src/dtc/tests/aliases.dts ================================================================= ==882911==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000000113 at pc 0x7f34ba0abf50 bp 0x7ffc8db22450 sp 0x7ffc8db21c00 READ of size 4 at 0x602000000113 thread T0 #0 0x7f34ba0abf4f in MemcmpInterceptorCommon(void*, int (*)(void const*, void const*, unsigned long), void const*, void const*, unsigned long) (/lib64/libasan.so.8+0xabf4f) #1 0x7f34ba0ac5e8 in memcmp (/lib64/libasan.so.8+0xac5e8) #2 0x4282dc in check_spi_bus_bridge ../checks.c:1110 #3 0x41b08d in check_nodes_props ../checks.c:140 #4 0x41b9c4 in run_check ../checks.c:180 #5 0x430a3b in process_checks ../checks.c:2056 #6 0x436a90 in main ../dtc.c:327 #7 0x7f34b964a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f) #8 0x7f34b964a5c8 in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x275c8) #9 0x4025c4 in _start (/home/elmarco/src/dtc/build/dtc+0x4025c4) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r--checks.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/checks.c b/checks.c
index 69f2649..8b1c604 100644
--- a/checks.c
+++ b/checks.c
@@ -1108,7 +1108,7 @@ static void check_spi_bus_bridge(struct check *c, struct dt_info *dti, struct no
for_each_child(node, child) {
struct property *prop;
for_each_property(child, prop) {
- if (strprefixeq(prop->name, 4, "spi-")) {
+ if (strstarts(prop->name, "spi-")) {
node->bus = &spi_bus;
break;
}