[RFC,08/15] gdbserver: Move pointer dereference to after assert checks.

Message ID ce9ac28dbb6fab0778cd8f23768340d9d77793d2.1444820235.git.henrik.wallin@windriver.com
State New, archived
Headers

Commit Message

henrik.wallin@windriver.com Oct. 14, 2015, 11:14 a.m. UTC
  From: Henrik Wallin <henrik.wallin@windriver.com>

gdb/gdbserver/ChangeLog:

	* linux-arm-low.c (arm_new_thread): Move pointer dereference
	to after assert checks.

Signed-off-by: Henrik Wallin <henrik.wallin@windriver.com>
---
 gdb/gdbserver/linux-arm-low.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Comments

Pedro Alves Oct. 15, 2015, 5:29 p.m. UTC | #1
On 10/14/2015 12:14 PM, henrik.wallin@windriver.com wrote:
> From: Henrik Wallin <henrik.wallin@windriver.com>
> 
> gdb/gdbserver/ChangeLog:
> 
> 	* linux-arm-low.c (arm_new_thread): Move pointer dereference
> 	to after assert checks.

OK.

Thanks,
Pedro Alves
  
henrik.wallin@windriver.com Oct. 29, 2015, 5:50 p.m. UTC | #2
2015-10-15 19:29 GMT+02:00 Pedro Alves <palves@redhat.com>:
> On 10/14/2015 12:14 PM, henrik.wallin@windriver.com wrote:
>> From: Henrik Wallin <henrik.wallin@windriver.com>
>>
>> gdb/gdbserver/ChangeLog:
>>
>>       * linux-arm-low.c (arm_new_thread): Move pointer dereference
>>       to after assert checks.
>
> OK.

Next step is?
I guess someone with push permissions need to pick this one up?

thanks,
/ Henrik
  
Antoine Tremblay Oct. 29, 2015, 5:53 p.m. UTC | #3
On 10/29/2015 01:50 PM, Wallin, Henrik wrote:
>
>
> 2015-10-15 19:29 GMT+02:00 Pedro Alves <palves@redhat.com>:
>> On 10/14/2015 12:14 PM, henrik.wallin@windriver.com wrote:
>>> From: Henrik Wallin <henrik.wallin@windriver.com>
>>>
>>> gdb/gdbserver/ChangeLog:
>>>
>>>        * linux-arm-low.c (arm_new_thread): Move pointer dereference
>>>        to after assert checks.
>>
>> OK.
>
> Next step is?
> I guess someone with push permissions need to pick this one up?
>

I can push it for you. (Most likely next week)

Regards,
Antoine
  
Antoine Tremblay Oct. 29, 2015, 6:31 p.m. UTC | #4
On 10/29/2015 01:53 PM, Antoine Tremblay wrote:
>
>
> On 10/29/2015 01:50 PM, Wallin, Henrik wrote:
>>
>>
>> 2015-10-15 19:29 GMT+02:00 Pedro Alves <palves@redhat.com>:
>>> On 10/14/2015 12:14 PM, henrik.wallin@windriver.com wrote:
>>>> From: Henrik Wallin <henrik.wallin@windriver.com>
>>>>
>>>> gdb/gdbserver/ChangeLog:
>>>>
>>>>        * linux-arm-low.c (arm_new_thread): Move pointer dereference
>>>>        to after assert checks.
>>>
>>> OK.
>>
>> Next step is?
>> I guess someone with push permissions need to pick this one up?
>>
>
> I can push it for you. (Most likely next week)
>

Pushed. I had the time now after all.
  

Patch

diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
index a277bb6876fb..81d23d953434 100644
--- a/gdb/gdbserver/linux-arm-low.c
+++ b/gdb/gdbserver/linux-arm-low.c
@@ -686,8 +686,8 @@  arm_new_thread (struct lwp_info *lwp)
 static void
 arm_new_fork (struct process_info *parent, struct process_info *child)
 {
-  struct arch_process_info *parent_proc_info = parent->priv->arch_private;
-  struct arch_process_info *child_proc_info = child->priv->arch_private;
+  struct arch_process_info *parent_proc_info;
+  struct arch_process_info *child_proc_info;
   struct lwp_info *child_lwp;
   struct arch_lwp_info *child_lwp_info;
   int i;
@@ -698,6 +698,9 @@  arm_new_fork (struct process_info *parent, struct process_info *child)
   gdb_assert (child->priv != NULL
 	      && child->priv->arch_private != NULL);
 
+  parent_proc_info = parent->priv->arch_private;
+  child_proc_info = child->priv->arch_private;
+
   /* Linux kernel before 2.6.33 commit
      72f674d203cd230426437cdcf7dd6f681dad8b0d
      will inherit hardware debug registers from parent