public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Potharla, Rupesh" <Rupesh.Potharla@amd.com>
To: "Potharla, Rupesh via Binutils" <binutils@sourceware.org>
Cc: "George, Jini Susan" <JiniSusan.George@amd.com>,
	"Parasuraman, Hariharan" <Hariharan.Parasuraman@amd.com>,
	"Natarajan, Kavitha" <Kavitha.Natarajan@amd.com>
Subject: [PATCH] bfd: Fix minor bug in read_indexed_address function.
Date: Fri, 26 Aug 2022 17:57:43 +0000	[thread overview]
Message-ID: <DM6PR12MB42198598871F1CFC842B9B4BE7759@DM6PR12MB4219.namprd12.prod.outlook.com> (raw)
Message-ID: <20220826175743.0vrHFe0eHuR--jBSVjRnttls8-CK-fYS6N0cMQWbmE4@z> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1203 bytes --]

[Public]


Hi,


read_indexed_address function is using offset_size instead of addr_size while reading addrx forms. Can you review my code changes and send in your comments/suggestions?


Patch Inlined:
------------------
---
bfd/dwarf2.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 69d30216771..6e5d40b8241 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -1412,7 +1412,7 @@ read_indexed_address (uint64_t idx, struct comp_unit *unit)
                     &file->dwarf_addr_buffer, &file->dwarf_addr_size))
     return 0;

-  if (_bfd_mul_overflow (idx, unit->offset_size, &offset))
+  if (_bfd_mul_overflow (idx, unit->addr_size, &offset))
     return 0;

   offset += unit->dwarf_addr_offset;
@@ -1423,9 +1423,9 @@ read_indexed_address (uint64_t idx, struct comp_unit *unit)

   info_ptr = file->dwarf_addr_buffer + offset;

-  if (unit->offset_size == 4)
+  if (unit->addr_size == 4)
     return bfd_get_32 (unit->abfd, info_ptr);
-  else if (unit->offset_size == 8)
+  else if (unit->addr_size == 8)
     return bfd_get_64 (unit->abfd, info_ptr);
   else
     return 0;
--

Regards,
Rupesh P

[-- Attachment #2: 0001-bfd-Fix-minor-bug-in-read_indexed_address-function.patch --]
[-- Type: application/octet-stream, Size: 1240 bytes --]

From afae5c52ed66f2fdc7be1f6b975eb1c1ca73fc4e Mon Sep 17 00:00:00 2001
From: rupothar <rupesh.potharla@amd.com>
Date: Fri, 26 Aug 2022 23:13:06 +0530
Subject: [PATCH] bfd: Fix minor bug in read_indexed_address function.

read_indexed_address function is using offset_size instead of
addr_size while reading addrx forms.
---
 bfd/dwarf2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 69d30216771..6e5d40b8241 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -1412,7 +1412,7 @@ read_indexed_address (uint64_t idx, struct comp_unit *unit)
 		     &file->dwarf_addr_buffer, &file->dwarf_addr_size))
     return 0;
 
-  if (_bfd_mul_overflow (idx, unit->offset_size, &offset))
+  if (_bfd_mul_overflow (idx, unit->addr_size, &offset))
     return 0;
 
   offset += unit->dwarf_addr_offset;
@@ -1423,9 +1423,9 @@ read_indexed_address (uint64_t idx, struct comp_unit *unit)
 
   info_ptr = file->dwarf_addr_buffer + offset;
 
-  if (unit->offset_size == 4)
+  if (unit->addr_size == 4)
     return bfd_get_32 (unit->abfd, info_ptr);
-  else if (unit->offset_size == 8)
+  else if (unit->addr_size == 8)
     return bfd_get_64 (unit->abfd, info_ptr);
   else
     return 0;
-- 
2.17.1


             reply	other threads:[~2022-08-26 17:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-26 17:57 Potharla, Rupesh [this message]
2022-08-26 17:57 ` Potharla, Rupesh
2022-08-27  5:00 ` Alan Modra

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=DM6PR12MB42198598871F1CFC842B9B4BE7759@DM6PR12MB4219.namprd12.prod.outlook.com \
    --to=rupesh.potharla@amd.com \
    --cc=Hariharan.Parasuraman@amd.com \
    --cc=JiniSusan.George@amd.com \
    --cc=Kavitha.Natarajan@amd.com \
    --cc=binutils@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).