* [PATCH v3] drm: use get_random_u64() where appropriate
@ 2026-04-05 15:47 David Carlier
0 siblings, 0 replies; only message in thread
From: David Carlier @ 2026-04-05 15:47 UTC (permalink / raw)
To: Jani Nikula, Rodrigo Vivi, Thomas Hellström
Cc: Joonas Lahtinen, Tvrtko Ursulin, David Airlie, Simona Vetter,
Matthew Brost, intel-gfx, dri-devel, intel-xe, linux-kernel,
David Carlier
Use the typed random integer helpers instead of
get_random_bytes() when filling a single integer variable.
The helpers return the value directly, require no pointer
or size argument, and better express intent.
Signed-off-by: David Carlier <devnexen@gmail.com>
---
drivers/gpu/drm/i915/i915_hdcp_gsc.c | 2 +-
drivers/gpu/drm/xe/xe_gsc_submit.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_hdcp_gsc.c b/drivers/gpu/drm/i915/i915_hdcp_gsc.c
index 168b9ccbef3e..a0510f5ab25c 100644
--- a/drivers/gpu/drm/i915/i915_hdcp_gsc.c
+++ b/drivers/gpu/drm/i915/i915_hdcp_gsc.c
@@ -196,7 +196,7 @@ static ssize_t intel_hdcp_gsc_msg_send(struct intel_hdcp_gsc_context *gsc_contex
memset(header_in, 0, msg_size_in);
memset(header_out, 0, msg_size_out);
- get_random_bytes(&host_session_id, sizeof(u64));
+ host_session_id = get_random_u64();
intel_gsc_uc_heci_cmd_emit_mtl_header(header_in, HECI_MEADDRESS_HDCP,
msg_size_in, host_session_id);
memcpy(gsc_context->hdcp_cmd_in + sizeof(*header_in), msg_in, msg_in_len);
diff --git a/drivers/gpu/drm/xe/xe_gsc_submit.c b/drivers/gpu/drm/xe/xe_gsc_submit.c
index 08082b596501..195f99e6c3a8 100644
--- a/drivers/gpu/drm/xe/xe_gsc_submit.c
+++ b/drivers/gpu/drm/xe/xe_gsc_submit.c
@@ -49,7 +49,7 @@ u64 xe_gsc_create_host_session_id(void)
{
u64 host_session_id;
- get_random_bytes(&host_session_id, sizeof(u64));
+ host_session_id = get_random_u64();
host_session_id &= ~HOST_SESSION_CLIENT_MASK;
return host_session_id;
}
--
2.53.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-04-05 15:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-05 15:47 [PATCH v3] drm: use get_random_u64() where appropriate David Carlier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox