Browse Source

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>
main
Marc-André Lureau 2 years ago committed by David Gibson
parent
commit
ee57999386
  1. 2
      checks.c

2
checks.c

@ -1108,7 +1108,7 @@ static void check_spi_bus_bridge(struct check *c, struct dt_info *dti, struct no @@ -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;
}

Loading…
Cancel
Save