-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple Coverity fixes for CAAM Driver, Crypto API and Core #6219
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For "drivers: caam: free resource upon dmaobj initialization failure":
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For "drivers: caam: mp: fix memory on CAAM descriptor allocation failure":
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For "crypto: rsamgf: initialize allocated buffer":
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For "drivers: caam: remove dead code":
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Use array index syntax instead of pointer arithmetic for better
readability.
This is a matter of preference, I believe @jenswi-linaro prefers the latter 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For "lib: libutee: fix use after free":
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments on "lib: libutee: initialize TA property type".
Please use prefix: "lib: libutee: TEE_GetPropertyAsString():"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For "core: tee: initialize tee_ta_param object":
Please use prefix: "core: tee: entry_open_session():".
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For "core: tee: initialize dirfile_entry objects":
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For "core: pta: attestation: check return value of crypto_bignum_bin2bn()":
One comment below, with that:
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
dea6549
to
f81cf08
Compare
For "lib: libutee: initialize TA property type" + fixup:
|
Force push: squash + rebase |
f81cf08
to
37246d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For "lib: libutee: fix use after free":
You're fixing a false positive, I think that should be mentioned in the commit message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For "lib: libutee: initialize TA property type"
I believe this is a false positive, but it's a good idea to plug it.
Especially since our coding guidelines require local variables to be initialized.
If you agree that it's a false positive please mention that in the commit message, or point out where the error is so I can double check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For "core: tee: entry_open_session(): initialize tee_ta_param object"
This seems to be a false positive too, please mention that in the commit message or point out where the error is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For "core: tee: initialize dirfile_entry objects"
All these looks like false positives, please update the commit message accordingly or point out where the error are.
Edit: I did some test, and it looks like Coverity can keep track of variable value even through its reference, the web interface is just confusing. So, regarding Uninitialized scalar variable issues, theses are not false positive. |
37246d9
to
667592d
Compare
For the commits:
please apply: |
Call caam_dmaobj_free() upon caam_dmaobj_init_[input|output}() failure to free buffer allocated by allocate_private(). Signed-off-by: Clement Faure <clement.faure@nxp.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Free the output DMA object upon CAAM descriptor allocation failure. Signed-off-by: Clement Faure <clement.faure@nxp.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
In drvcrypt_rsa_mgf1() function, the memcpy() could potentially copy an uninitialized buffer. Allocate and initialize tmpdigest buffer with calloc() instead of malloc(). Signed-off-by: Clement Faure <clement.faure@nxp.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Remove value check as it cannot be true and appears to be dead code. Use array index syntax instead of pointer arithmetic for better readability. Signed-off-by: Clement Faure <clement.faure@nxp.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Make sure to call addr_is_in_no_share_heap() before the freeing buffer. This is a false positive as only the pointer value is used and not the memory freed. Signed-off-by: Clement Faure <clement.faure@nxp.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
TA property type `type` is declared without being initialized and might be used in the if statement uninitialized. Signed-off-by: Clement Faure <clement.faure@nxp.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Initialize tee_ta_param{} to zero in entry_open_session() so it can be used initialized in cleanup_shm_refs() without Coverity error. Signed-off-by: Clement Faure <clement.faure@nxp.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Coverity reports many errors where dirfile_entry{} is used un-initialized. Resolve these errors by setting these objects to zero on declaration. Signed-off-by: Clement Faure <clement.faure@nxp.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Check the return value of crypto_bignum_bin2bn(). Signed-off-by: Clement Faure <clement.faure@nxp.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Initialize local variables at declaration as specified by the coding guidelines. Signed-off-by: Clement Faure <clement.faure@nxp.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Initialize local variables at declaration as specified by the coding guidelines. Signed-off-by: Clement Faure <clement.faure@nxp.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
667592d
to
e84bffc
Compare
Force-push : tag applied + re-word commits since uninitialized scalar value issues are not false positive |
Hello,
Our CI reported multiple Coverity issues in optee-os. The issues fixed in this pull-request are rated
High
andMedium
impact. As a maintainer of the crypto driver API and the CAAM, I want to push 2878ec6 b3b0567 1ba0f6d d34d5c5.At the same time, I also fixed some issues in libutee, PTA attestation and the core. Feel free to comment regarding commits d68119a dae33b6 a6c6ab0 726f19e b98fa53
Thanks!