Skip to contentSkip to conversation

drivers/isdn: Use get_random_u32()

RFC PATCH In review George Spelvin 1 participant 1 message Mar 28, 2020

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

RFC PATCH 43/50 drivers/isdn: Use get_random_u32()

There's no need to get_random_bytes() into a temporary buffer.

This is not a no-brainer change; get_random_u32() has slightly weaker security guarantees, but they're fine for applications like these where the random value is stored in the kernel for as long as it's valuable.

---
 drivers/isdn/mISDN/tei.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/isdn/mISDN/tei.c +1 -4
index 59d28cb19738e..8135e20a667cc 100644
@@ -404,10 +404,7 @@ dl_unit_data(struct manager *mgr, struct sk_buff *skb)
 static unsigned int
 random_ri(void)
 {
-	u16 x;
-
-	get_random_bytes(&x, sizeof(x));
-	return x;
+	return get_random_u32() & 0xffff;
 }
 
 static struct layer2 *
Signature · 1 line
2.26.0