queue.c: move a stack variable before the variable array
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Oct 2014 08:23:27 +0000 (10:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Oct 2014 08:23:27 +0000 (10:23 +0200)
This way the compiler doesn't have to calculate the location of the
pointer "on the fly".

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
queue.c

diff --git a/queue.c b/queue.c
index 56f102a7877dba485b9aea95da249d0d99a5b67b..e89d7200719258437533952aea5c11ad274f60d6 100644 (file)
--- a/queue.c
+++ b/queue.c
@@ -579,6 +579,7 @@ int kdbus_queue_entry_alloc(struct kdbus_conn *conn,
                            struct kdbus_queue_entry **e)
 {
        struct kdbus_queue_entry *entry;
+       struct kdbus_item *it;
        u64 msg_size;
        size_t size;
        size_t dst_name_len = 0;
@@ -664,8 +665,8 @@ int kdbus_queue_entry_alloc(struct kdbus_conn *conn,
 
        if (dst_name_len  > 0) {
                char tmp[KDBUS_ITEM_HEADER_SIZE + dst_name_len];
-               struct kdbus_item *it = (struct kdbus_item *)tmp;
 
+               it = (struct kdbus_item *)tmp;
                it->size = KDBUS_ITEM_HEADER_SIZE + dst_name_len;
                it->type = KDBUS_ITEM_DST_NAME;
                memcpy(it->str, kmsg->dst_name, dst_name_len);
@@ -686,8 +687,8 @@ int kdbus_queue_entry_alloc(struct kdbus_conn *conn,
        /* add a FDS item; the array content will be updated at RECV time */
        if (kmsg->fds_count > 0) {
                char tmp[KDBUS_ITEM_HEADER_SIZE];
-               struct kdbus_item *it = (struct kdbus_item *)tmp;
 
+               it = (struct kdbus_item *)tmp;
                it->type = KDBUS_ITEM_FDS;
                it->size = KDBUS_ITEM_HEADER_SIZE +
                           (kmsg->fds_count * sizeof(int));