public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH] libebl: ebl_object_note print 32bit annobin address ranges correctly
Date: Wed, 21 Feb 2024 21:59:14 +0100	[thread overview]
Message-ID: <20240221205914.2144167-1-mark@klomp.org> (raw)

Annobin address ranges were always printed as if they were 64bit wide
because addr_size was set to twice the size. This was done because the
note description size should contain two addresses. Fix this by setting
the address size to just one address and then check that descsz is
twice that.

	* libebl/eblobjnote.c (ebl_object_note): Set addr_size to one
	ELF_T_ADDR. Check descsz equals two times addr_size.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 libebl/eblobjnote.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libebl/eblobjnote.c b/libebl/eblobjnote.c
index 5a7c5c62..1ba5d8b3 100644
--- a/libebl/eblobjnote.c
+++ b/libebl/eblobjnote.c
@@ -155,8 +155,8 @@ ebl_object_note (Ebl *ebl, uint32_t namesz, const char *name, uint32_t type,
 	      } addrs;
 
 	      size_t addr_size = gelf_fsize (ebl->elf, ELF_T_ADDR,
-					     2, EV_CURRENT);
-	      if (descsz != addr_size)
+					     1, EV_CURRENT);
+	      if (descsz != addr_size * 2)
 		printf ("<unknown data>\n");
 	      else
 		{
-- 
2.39.3


             reply	other threads:[~2024-02-21 21:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21 20:59 Mark Wielaard [this message]
2024-02-27 14:58 ` Mark Wielaard

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=20240221205914.2144167-1-mark@klomp.org \
    --to=mark@klomp.org \
    --cc=elfutils-devel@sourceware.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).