]> git.ipfire.org Git - thirdparty/u-boot.git/commit
board: dhelectronics: Check pointer before access in dh_get_value_from_eeprom_buffer()
authorMarek Vasut <marek.vasut@mailbox.org>
Sun, 7 Sep 2025 01:00:46 +0000 (03:00 +0200)
committerTom Rini <trini@konsulko.com>
Wed, 17 Sep 2025 15:06:37 +0000 (09:06 -0600)
commit5634cf1afcf17fda0136693f02a843aa6b938b2b
tree0d17b1c2504c50246009f5667b8a9d439079d9f0
parenteea731b50c6155b9ec0ccd039590b9cefdafd024
board: dhelectronics: Check pointer before access in dh_get_value_from_eeprom_buffer()

The eip pointer in dh_get_value_from_eeprom_buffer() might be NULL.
The current NULL pointer check happens too late, after the eip was
accessed in variable assignment. Reorder the two, so the NULL pointer
check happens first, and any access second, otherwise the access may
trigger a hang or other undefined behavior.

Signed-off-by: Marek Vasut <marek.vasut@mailbox.org>
Reviewed-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>
board/dhelectronics/common/dh_common.c