lib/pb-protocol: fix deserialise of boot option priorities
authorJeremy Kerr <jk@ozlabs.org>
Mon, 7 Apr 2014 07:22:46 +0000 (15:22 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Mon, 7 Apr 2014 07:22:46 +0000 (15:22 +0800)
Commit aa530148 introduced a priority member to struct boot_priority,
but didn't update the protocol deserialise function to properly decode
config messages. This meant we were leaving half of the struct
uninitialised, and getting invalid values in the initialised part.

This change updates the config deserialise function to do proper
handling for boot priority data.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
lib/pb-protocol/pb-protocol.c

index 3c472febdb14c88a7a0ef82112230c2d67d2fbc3..cf27b8ec49c35ff47bfdfff00cc43f36e9f06015 100644 (file)
@@ -890,6 +890,9 @@ int pb_protocol_deserialise_config(struct config *config,
                        config->n_boot_priorities);
 
        for (i = 0; i < config->n_boot_priorities; i++) {
+               if (read_u32(&pos, &len, &tmp))
+                       goto out;
+               config->boot_priorities[i].priority = (int)tmp;
                if (read_u32(&pos, &len, &tmp))
                        goto out;
                config->boot_priorities[i].type = tmp;