Skip to contentSkip to conversation

Handle null pointer returned by of_overlay_fix_path properly

DISCUSSION Michael Riesch 2 participants 2 messages Jun 22, 2022 – Jun 29, 2022

lore
Share & tools
lore
#0 lore raw

Hi all,

The function of_overlay_fix_path returns NULL in certain error cases but of_overlay_apply_symbols (which is the only caller) does not check the return value. For broken overlays this may result in an exception, which is probably not the best way to deal with this situation. I am not sure though what would be a good way to handle this error condition. Since the call happens in a loop, we may want to ignore the symbol in question and continue? Any thoughts?

Best regards,
Michael

#1 lore raw

Hello Michael,

Quoted 9 lines · Michael Riesch

Hi all,

The function of_overlay_fix_path returns NULL in certain error cases but of_overlay_apply_symbols (which is the only caller) does not check the return value. For broken overlays this may result in an exception, which is probably not the best way to deal with this situation. I am not sure though what would be a good way to handle this error condition. Since the call happens in a loop, we may want to ignore the symbol in question and continue? Any thoughts?

I would abort overlay application on first error. If this can only happen because of a malformed overlay, it makes no sense to apply the overlay partially. Exiting with an error message is a service to the user to investigate where it went wrong.

Cheers,
Ahmad

Quoted 5 lines

Best regards,
Michael

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |