public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] bfd: Fix minor bug in read_indexed_address function.
@ 2022-08-26 17:57 Potharla, Rupesh
  2022-08-26 17:57 ` Potharla, Rupesh
  2022-08-27  5:00 ` Alan Modra
  0 siblings, 2 replies; 3+ messages in thread
From: Potharla, Rupesh @ 2022-08-26 17:57 UTC (permalink / raw)
  To: Potharla, Rupesh via Binutils
  Cc: George, Jini Susan, Parasuraman, Hariharan, Natarajan, Kavitha

[-- Attachment #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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] bfd: Fix minor bug in read_indexed_address function.
  2022-08-26 17:57 [PATCH] bfd: Fix minor bug in read_indexed_address function Potharla, Rupesh
@ 2022-08-26 17:57 ` Potharla, Rupesh
  2022-08-27  5:00 ` Alan Modra
  1 sibling, 0 replies; 3+ messages in thread
From: Potharla, Rupesh @ 2022-08-26 17:57 UTC (permalink / raw)
  To: Potharla, Rupesh via Binutils
  Cc: George, Jini Susan, Parasuraman, Hariharan, Natarajan, Kavitha


[-- 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] bfd: Fix minor bug in read_indexed_address function.
  2022-08-26 17:57 [PATCH] bfd: Fix minor bug in read_indexed_address function Potharla, Rupesh
  2022-08-26 17:57 ` Potharla, Rupesh
@ 2022-08-27  5:00 ` Alan Modra
  1 sibling, 0 replies; 3+ messages in thread
From: Alan Modra @ 2022-08-27  5:00 UTC (permalink / raw)
  To: Potharla, Rupesh
  Cc: Potharla, Rupesh via Binutils, George, Jini Susan, Parasuraman,
	Hariharan, Natarajan, Kavitha

On Fri, Aug 26, 2022 at 05:57:43PM +0000, Potharla, Rupesh via Binutils wrote:
> 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?

Applied, thanks!

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-27  5:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-26 17:57 [PATCH] bfd: Fix minor bug in read_indexed_address function Potharla, Rupesh
2022-08-26 17:57 ` Potharla, Rupesh
2022-08-27  5:00 ` Alan Modra

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).