Skip to contentSkip to conversation

hwrng: Use UUID API for exporting the UUID

PATCH In review Andy Shevchenko 3 participants 3 messages Apr 22, 2020 – Apr 30, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwrng: Use UUID API for exporting the UUID

There is export_uuid() function which exports uuid_t to the u8 array. Use it instead of open coding variant.

This allows to hide the uuid_t internals.

---
 drivers/char/hw_random/optee-rng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/hw_random/optee-rng.c +1 -1
index ddfbabaa5f8f6..49b2e02537ddb 100644
@@ -226,7 +226,7 @@ static int optee_rng_probe(struct device *dev)
 		return -ENODEV;
 
 	/* Open session with hwrng Trusted App */
-	memcpy(sess_arg.uuid, rng_device->id.uuid.b, TEE_IOCTL_UUID_LEN);
+	export_uuid(sess_arg.uuid, &rng_device->id.uuid);
 	sess_arg.clnt_login = TEE_IOCTL_LOGIN_PUBLIC;
 	sess_arg.num_params = 0;
 
Signature · 1 line
2.26.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Andy Shevchenko

There is export_uuid() function which exports uuid_t to the u8 array. Use it instead of open coding variant.

This allows to hide the uuid_t internals.

---
 drivers/char/hw_random/optee-rng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
drivers/char/hw_random/optee-rng.c +1 -2
index ddfbabaa5f8f6..49b2e02537ddb 100644
@@ -226,7 +226,7 @@ static int optee_rng_probe(struct device *dev)
                return -ENODEV;
 
        /* Open session with hwrng Trusted App */
-       memcpy(sess_arg.uuid, rng_device->id.uuid.b, TEE_IOCTL_UUID_LEN);
+       export_uuid(sess_arg.uuid, &rng_device->id.uuid);
        sess_arg.clnt_login = TEE_IOCTL_LOGIN_PUBLIC;
        sess_arg.num_params = 0;
 
--

2.26.1

maintainer
#2 lore raw
In reply to Andy Shevchenko
Quoted 9 lines · Andy Shevchenko

There is export_uuid() function which exports uuid_t to the u8 array. Use it instead of open coding variant.

This allows to hide the uuid_t internals.

---
 drivers/char/hw_random/optee-rng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt