All of lore.kernel.org
 help / color / mirror / Atom feed
From: Glenn Washburn <development@efficientek.com>
To: grub-devel@gnu.org, Daniel Kiper <daniel.kiper@oracle.com>
Cc: Glenn Washburn <development@efficientek.com>
Subject: [PATCH 3/4] luks2: Add error message strings to errors in luks2_read_header
Date: Fri, 19 Mar 2021 19:14:50 -0500	[thread overview]
Message-ID: <7a620e54750db45461853d7a563d58adedad5afc.1616198999.git.development@efficientek.com> (raw)
In-Reply-To: <cover.1616198999.git.development@efficientek.com>

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

diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c
index 4b259cbdb..2ed9e5a80 100644
--- a/grub-core/disk/luks2.c
+++ b/grub-core/disk/luks2.c
@@ -328,7 +328,7 @@ luks2_read_header (grub_disk_t disk, grub_luks2_header_t *outhdr)
   /* Look for LUKS magic sequence.  */
   if (grub_memcmp (primary.magic, LUKS_MAGIC_1ST, sizeof (primary.magic)) ||
       grub_be_to_cpu16 (primary.version) != 2)
-    return GRUB_ERR_BAD_SIGNATURE;
+    return grub_error (GRUB_ERR_BAD_SIGNATURE, "Bad primary signature");
 
   /* Read the secondary header. */
   ret = grub_disk_read (disk, 0, grub_be_to_cpu64 (primary.hdr_size), sizeof (secondary), &secondary);
@@ -338,7 +338,7 @@ luks2_read_header (grub_disk_t disk, grub_luks2_header_t *outhdr)
   /* Look for LUKS magic sequence.  */
   if (grub_memcmp (secondary.magic, LUKS_MAGIC_2ND, sizeof (secondary.magic)) ||
       grub_be_to_cpu16 (secondary.version) != 2)
-    return GRUB_ERR_BAD_SIGNATURE;
+    return grub_error (GRUB_ERR_BAD_SIGNATURE, "Bad secondary signature");
 
   if (grub_be_to_cpu64 (primary.seqid) < grub_be_to_cpu64 (secondary.seqid))
       header = &secondary;
-- 
2.27.0



  parent reply	other threads:[~2021-03-20  0:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-20  0:14 [PATCH 0/4] Various LUKS2 improvements Glenn Washburn
2021-03-20  0:14 ` [PATCH 1/4] luks2: Continue trying all keyslots even if there are some failures Glenn Washburn
2021-03-20  0:14 ` [PATCH 2/4] luks2: Add error message strings to crypto errors Glenn Washburn
2021-03-20  0:14 ` Glenn Washburn [this message]
2021-03-20  0:14 ` [PATCH 4/4] luks2: Fix potential grub_free with NULL pointer Glenn Washburn
2021-03-23 17:43 ` [PATCH 0/4] Various LUKS2 improvements Daniel Kiper
2021-03-23 19:41   ` Daniel Kiper
2021-03-24  4:01   ` Glenn Washburn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7a620e54750db45461853d7a563d58adedad5afc.1616198999.git.development@efficientek.com \
    --to=development@efficientek.com \
    --cc=daniel.kiper@oracle.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.