diff mbox series

tee: optee: fix uuid comparisons on service discovery

Message ID 20230119092137.268465-1-ilias.apalodimas@linaro.org
State Accepted
Commit eda976d36a37d459da5908fb922173a4bafe8666
Headers show
Series tee: optee: fix uuid comparisons on service discovery | expand

Commit Message

Ilias Apalodimas Jan. 19, 2023, 9:21 a.m. UTC
When comparing UUIDs for discovered services we only compare up to the
ptr size instead of the entire UUID

Fixes: 94ccfb78a4d61 ("drivers: tee: optee: discover OP-TEE services")
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
 drivers/tee/optee/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.38.1

Comments

Jens Wiklander Jan. 19, 2023, 3:09 p.m. UTC | #1
On Thu, Jan 19, 2023 at 10:21 AM Ilias Apalodimas
<ilias.apalodimas@linaro.org> wrote:
>
> When comparing UUIDs for discovered services we only compare up to the
> ptr size instead of the entire UUID
>
> Fixes: 94ccfb78a4d61 ("drivers: tee: optee: discover OP-TEE services")
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> ---
>  drivers/tee/optee/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

Cheers,
Jens

>
> diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> index 88e23d252bcd..9a9b697e91f5 100644
> --- a/drivers/tee/optee/core.c
> +++ b/drivers/tee/optee/core.c
> @@ -73,7 +73,7 @@ static struct optee_service *find_service_driver(const struct tee_optee_ta_uuid
>
>         for (idx = 0; idx < service_cnt; idx++, service++) {
>                 tee_optee_ta_uuid_to_octets(loc_uuid, &service->uuid);
> -               if (!memcmp(uuid, loc_uuid, sizeof(uuid)))
> +               if (!memcmp(uuid, loc_uuid, sizeof(*uuid)))
>                         return service;
>         }
>
> --
> 2.38.1
>
Etienne Carriere Jan. 20, 2023, 7:51 a.m. UTC | #2
On Thu, 19 Jan 2023 at 10:21, Ilias Apalodimas
<ilias.apalodimas@linaro.org> wrote:
>
> When comparing UUIDs for discovered services we only compare up to the
> ptr size instead of the entire UUID
>
> Fixes: 94ccfb78a4d61 ("drivers: tee: optee: discover OP-TEE services")
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> ---
>  drivers/tee/optee/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> index 88e23d252bcd..9a9b697e91f5 100644
> --- a/drivers/tee/optee/core.c
> +++ b/drivers/tee/optee/core.c
> @@ -73,7 +73,7 @@ static struct optee_service *find_service_driver(const struct tee_optee_ta_uuid
>
>         for (idx = 0; idx < service_cnt; idx++, service++) {
>                 tee_optee_ta_uuid_to_octets(loc_uuid, &service->uuid);
> -               if (!memcmp(uuid, loc_uuid, sizeof(uuid)))
> +               if (!memcmp(uuid, loc_uuid, sizeof(*uuid)))
>                         return service;
>         }
>
> --
> 2.38.1
>

Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
diff mbox series

Patch

diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index 88e23d252bcd..9a9b697e91f5 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -73,7 +73,7 @@  static struct optee_service *find_service_driver(const struct tee_optee_ta_uuid

 	for (idx = 0; idx < service_cnt; idx++, service++) {
 		tee_optee_ta_uuid_to_octets(loc_uuid, &service->uuid);
-		if (!memcmp(uuid, loc_uuid, sizeof(uuid)))
+		if (!memcmp(uuid, loc_uuid, sizeof(*uuid)))
 			return service;
 	}