RTEMS | bsps/powerpc: The sbrk policy default and the exception frames (!1414)
Joel Sherrill (@joel)
gitlab at rtems.org
Thu Aug 20 22:55:04 UTC 2026
Joel Sherrill commented on a discussion on bsps/powerpc/shared/start/sbrk.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1414#note_157489
> remaining_size = rval;
> }
>
> - policy = (0 == BSP_sbrk_policy[0] ? (uintptr_t)(-1) : BSP_sbrk_policy[0]);
> + /*
> + * BSP_sbrk_policy is an optional application provided symbol. Test the
> + * symbol address before the dereference, otherwise an application which
> + * does not provide the symbol reads whatever resides at address zero.
> + */
> + if (BSP_sbrk_policy == NULL || 0 == BSP_sbrk_policy[0]) {
Using a constant as the left hand side is a good practice to catch the case where == is accidentally =. I don't know if we have covered this yet in our coding style, but I am happy to see it this way. It is safer.
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1414#note_157489
You're receiving this email because of your account on gitlab.rtems.org. Unsubscribe from this thread: https://gitlab.rtems.org/-/sent_notifications/5-bg4ndvlktmfd0fbav7km8mljh-1d/unsubscribe | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | Help: https://gitlab.rtems.org/help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260820/b37e2144/attachment-0001.htm>
More information about the bugs
mailing list