* Initialize status in gdbserver/linux-low.c
@ 2012-07-16 15:55 Sterling Augustine
2012-07-16 16:06 ` Pedro Alves
0 siblings, 1 reply; 3+ messages in thread
From: Sterling Augustine @ 2012-07-16 15:55 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 372 bytes --]
Hi,
As the code for handle_extended_wait exists today, status can be used
uninitialized on line 486 if pull_pid_from_list on line 451 returns
true.
This near-trivial patch initializes it to zero at the declaration.
OK for mainline?
Sterling
2012-07-07 Sterling Augustine <saugustine@google.com>
* gdbserver/linux-low.c (handle_extended_wait): Initialize status.
[-- Attachment #2: patch --]
[-- Type: application/octet-stream, Size: 492 bytes --]
Index: linux-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-low.c,v
retrieving revision 1.226
diff -d -u -r1.226 linux-low.c
--- linux-low.c 7 Jul 2012 12:13:57 -0000 1.226
+++ linux-low.c 16 Jul 2012 15:50:12 -0000
@@ -443,7 +443,7 @@
{
ptid_t ptid;
unsigned long new_pid;
- int ret, status;
+ int ret, status = 0;
ptrace (PTRACE_GETEVENTMSG, lwpid_of (event_child), 0, &new_pid);
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Initialize status in gdbserver/linux-low.c
2012-07-16 15:55 Initialize status in gdbserver/linux-low.c Sterling Augustine
@ 2012-07-16 16:06 ` Pedro Alves
2012-07-16 17:09 ` Sterling Augustine
0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2012-07-16 16:06 UTC (permalink / raw)
To: Sterling Augustine; +Cc: gdb-patches
On 07/16/2012 04:54 PM, Sterling Augustine wrote:
> Hi,
>
> As the code for handle_extended_wait exists today, status can be used
> uninitialized on line 486 if pull_pid_from_list on line 451 returns
> true.
If pull_pid_from_list returns true, then it has written to status.
Sounds like you're getting a false positive warning?
>
> This near-trivial patch initializes it to zero at the declaration.
>
> OK for mainline?
If this is indeed a false warning, then this is okay with
a "Avoid GCC false warning" comment or some such.
--
Pedro Alves
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Initialize status in gdbserver/linux-low.c
2012-07-16 16:06 ` Pedro Alves
@ 2012-07-16 17:09 ` Sterling Augustine
0 siblings, 0 replies; 3+ messages in thread
From: Sterling Augustine @ 2012-07-16 17:09 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
On Mon, Jul 16, 2012 at 9:06 AM, Pedro Alves <palves@redhat.com> wrote:
> On 07/16/2012 04:54 PM, Sterling Augustine wrote:
>> Hi,
>>
>> As the code for handle_extended_wait exists today, status can be used
>> uninitialized on line 486 if pull_pid_from_list on line 451 returns
>> true.
>
> If pull_pid_from_list returns true, then it has written to status.
> Sounds like you're getting a false positive warning?
>
>>
>> This near-trivial patch initializes it to zero at the declaration.
>>
>> OK for mainline?
>
> If this is indeed a false warning, then this is okay with
> a "Avoid GCC false warning" comment or some such.
My mistake. I was compiling an older version of gdb where
pull_pid_from_list didn't include the third parameter. Then forward
ported the fix.
Sterling
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-07-16 17:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-16 15:55 Initialize status in gdbserver/linux-low.c Sterling Augustine
2012-07-16 16:06 ` Pedro Alves
2012-07-16 17:09 ` Sterling Augustine
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox