From 548f8ac69b41f6f2169240143df1106cafd62ba4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 20 Jan 2014 10:44:37 +0100 Subject: [PATCH] use the kernel's generate_random_uuid() --- bus.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/bus.c b/bus.c index fdc4a1c..37f45d4 100644 --- a/bus.c +++ b/bus.c @@ -41,10 +41,12 @@ bool kdbus_bus_uid_is_privileged(const struct kdbus_bus *bus) /** * kdbus_bus_ref() - increase the reference counter of a kdbus_bus - * @bus: The bus to unref + * @bus: The bus to reference * * Every user of a bus, except for its creator, must add a reference to the * kdbus_bus using this function. + * + * Return: the bus itself */ struct kdbus_bus *kdbus_bus_ref(struct kdbus_bus *bus) { @@ -215,16 +217,8 @@ int kdbus_bus_new(struct kdbus_ns *ns, INIT_LIST_HEAD(&b->monitors_list); atomic64_set(&b->conn_seq_last, 0); - /* generate unique ID for this bus */ - get_random_bytes(b->id128, sizeof(b->id128)); - - /* Set UUID version to 4 --- truly random generation */ - b->id128[6] &= 0x0f; - b->id128[6] |= 0x40; - - /* Set the UUID variant to DCE */ - b->id128[8] &= 0x3f; - b->id128[8] |= 0x80; + /* generate unique bus id */ + generate_random_uuid(b->id128); b->name = kstrdup(name, GFP_KERNEL); if (!b->name) { -- 2.34.1