[PATCH master] optee: check optee_verify_header argument for error pointers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



optee_verify_header is called at two places with
imx_scratch_get_optee_hdr() as argument, which returns an error pointer.

Check against that to avoid crashing in error cases.

Suggested-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx>
Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 common/optee.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/optee.c b/common/optee.c
index a8a43554e757..7fe93e441974 100644
--- a/common/optee.c
+++ b/common/optee.c
@@ -10,7 +10,7 @@ static u64 optee_membase = U64_MAX;
 
 int optee_verify_header(const struct optee_header *hdr)
 {
-	if (!hdr)
+	if (IS_ERR_OR_NULL(hdr))
 		return -EINVAL;
 
 	if (hdr->magic != OPTEE_MAGIC) {
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux