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
_______________________________________________ bugs mailing list [email protected] http://lists.rtems.org/mailman/listinfo/bugs
