setup: if all BootXXXX are used, find the next slot behind, don't overwrite Boot0000
authorKay Sievers <kay@vrfy.org>
Sat, 16 Mar 2013 17:41:06 +0000 (18:41 +0100)
committerKay Sievers <kay@vrfy.org>
Sat, 16 Mar 2013 17:41:06 +0000 (18:41 +0100)
https://bbs.archlinux.org/viewtopic.php?pid=1242470#p1242470

src/setup/setup.c

index 962126c..c9249ee 100644 (file)
@@ -900,6 +900,11 @@ static int find_slot(const uint8_t uuid[16], const char *path, uint16_t *id) {
                         goto finish;
                 }
 
+        /* use the next one */
+        if (i == 0xffff)
+                return -ENOSPC;
+        new_id = i;
+
 finish:
         *id = new_id;
         free(options);