notify: set item->size
authorDaniel Mack <daniel@zonque.org>
Thu, 16 Oct 2014 09:16:20 +0000 (11:16 +0200)
committerDaniel Mack <daniel@zonque.org>
Thu, 16 Oct 2014 09:16:20 +0000 (11:16 +0200)
Fully initialize the API. We should also have strict checking for this
on userspace.

Signed-off-by: Daniel Mack <daniel@zonque.org>
notify.c

index c68add64cbf0be448f15d97632b52d67194f927a..ca7f408a8312aa7b76b0aa0dce5f07f8a3d57e65 100644 (file)
--- a/notify.c
+++ b/notify.c
@@ -49,6 +49,7 @@ static int kdbus_notify_reply(struct kdbus_bus *bus, u64 id,
        kmsg->msg.src_id = KDBUS_SRC_ID_KERNEL;
        kmsg->msg.payload_type = KDBUS_PAYLOAD_KERNEL;
        kmsg->msg.cookie_reply = cookie;
+       kmsg->msg.items[0].size = KDBUS_ITEM_HEADER_SIZE;
        kmsg->msg.items[0].type = msg_type;
 
        spin_lock(&bus->notify_lock);
@@ -123,6 +124,7 @@ int kdbus_notify_name_change(struct kdbus_bus *bus, u64 type,
        kmsg->notify_type = type;
        kmsg->notify_old_id = old_id;
        kmsg->notify_new_id = new_id;
+       kmsg->msg.items[0].size = extra_size;
        kmsg->msg.items[0].type = type;
        kmsg->msg.items[0].name_change.old_id.id = old_id;
        kmsg->msg.items[0].name_change.old_id.flags = old_flags;
@@ -174,6 +176,7 @@ int kdbus_notify_id_change(struct kdbus_bus *bus, u64 type, u64 id, u64 flags)
                BUG();
        }
 
+       kmsg->msg.items[0].size = sizeof(struct kdbus_notify_id_change);
        kmsg->msg.items[0].type = type;
        kmsg->msg.items[0].id_change.id = id;
        kmsg->msg.items[0].id_change.flags = flags;