Home
last modified time | relevance | path

Searched hist:a83ee50a804731193ecc1867b80b591fa3ed103c (Results 1 – 1 of 1) sorted by relevance

/optee_os/lib/libutee/
H A Dtee_api.ca83ee50a804731193ecc1867b80b591fa3ed103c Tue Sep 07 09:53:37 UTC 2021 Sadiq Hussain <sadiq.muchumarri@intel.com> libutee: Handle zero sized buffer allocations

The GlobalPlatform TEE internal API specification mentions the following
about zero sized buffer allocations:
"The value returned is undefined but guaranteed to be different from NULL.
The Trusted Application SHALL NOT access the returned pointer.
The Trusted Application SHOULD panic if the memory pointed to by such a
pointer is accessed for either read or write"

But, we would never observe a TA panic because a zero size is internally
translated to 1 and finally to (2 * sizeof(long)) in the bget() function.

This patch handles this aspect so to return a known non-NULL invalid
pointer when the requested size is zero.

Signed-off-by: Sadiq Hussain <sadiq.muchumarri@intel.com>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>