libckteec: add and use {ADD|SUB|MUL}_OVERFLOW() macros#421
Open
etienne-lms wants to merge 2 commits into
Open
Conversation
Add ADD_OVERFLOW(), SUB_OVERFLOW() and MUL_OVERFLOW() helper macros dumped from optee_os util.h [1] and compiler.h [3] where released under the same BSD-2-Clause license terms used in libckteec implementation. Link: https://github.com/OP-TEE/optee_os/blob/4.10.0/lib/libutils/ext/include/util.h [1] Link: https://github.com/OP-TEE/optee_os/blob/4.10.0/lib/libutils/ext/include/compiler.h [2] Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Guard against overflow in buffer size before they are allocated. Guard against overflow in when serializing data send to the TA. Use *_OVERFLOW() macros where applicable instead of less intuitive implementation. Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
ADD_OVERFLOW(),SUB_OVERFLOW()andMUL_OVERFLOW()helper macros dumped from optee_os util.h [1] and compiler.h [2] and use them to guard against index/buffer overflows.[1] https://github.com/OP-TEE/optee_os/blob/4.10.0/lib/libutils/ext/include/util.h
[2] https://github.com/OP-TEE/optee_os/blob/4.10.0/lib/libutils/ext/include/compiler.h