Use the return value of grub_snprintf() to move the string pointer forward,
instead of incrementing the string pointer iteratively until a NULL byte is
reached. Move the space out of the format string argument, a small
optimization, but also makes the spacing clearer. Also, use the new
PRIxGRUB_OFFSET instead of PRIuGRUB_UINT64_T to accurately reflect the
format string for this type.

Signed-off-by: Glenn Washburn <developm...@efficientek.com>
---
 grub-core/disk/cryptodisk.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c
index 34b67a705fbc..c62656a0faea 100644
--- a/grub-core/disk/cryptodisk.c
+++ b/grub-core/disk/cryptodisk.c
@@ -1503,9 +1503,8 @@ luks_script_get (grub_size_t *sz)
        ptr = grub_stpcpy (ptr, "luks_mount ");
        ptr = grub_stpcpy (ptr, i->uuid);
        *ptr++ = ' ';
-       grub_snprintf (ptr, 21, "%" PRIuGRUB_UINT64_T " ", i->offset_sectors);
-       while (*ptr)
-         ptr++;
+       ptr += grub_snprintf (ptr, 21, "%" PRIxGRUB_OFFSET, i->offset_sectors);
+       *ptr++ = ' ';
        for (iptr = i->cipher->cipher->name; *iptr; iptr++)
          *ptr++ = grub_tolower (*iptr);
        switch (i->mode)
-- 
2.34.1


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to