* [Powertop] [PATCH] prevent jump on uninitialized value
@ 2012-06-27 8:17 Sergey Senozhatsky
0 siblings, 0 replies; 2+ messages in thread
From: Sergey Senozhatsky @ 2012-06-27 8:17 UTC (permalink / raw)
To: powertop
[-- Attachment #1: Type: text/plain, Size: 614 bytes --]
workload is getting 'initialized' with stack garbage,
so later conditional check of !workload[0] in report()
is invalid.
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
---
src/main.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main.cpp b/src/main.cpp
index d8e2a47..7a1b976 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -356,7 +356,7 @@ int main(int argc, char **argv)
int c;
bool wantreport = FALSE;
char filename[4096];
- char workload[4096];
+ char workload[4096] = {0,};
int iterations = 1;
#ifndef DISABLE_TRYCATCH
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Powertop] [PATCH] prevent jump on uninitialized value
@ 2012-06-27 18:20 Chris Ferron
0 siblings, 0 replies; 2+ messages in thread
From: Chris Ferron @ 2012-06-27 18:20 UTC (permalink / raw)
To: powertop
[-- Attachment #1: Type: text/plain, Size: 751 bytes --]
patch applied
Thanks
-C
On 06/27/2012 01:17 AM, Sergey Senozhatsky wrote:
> workload is getting 'initialized' with stack garbage,
> so later conditional check of !workload[0] in report()
> is invalid.
>
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
>
> ---
>
> src/main.cpp | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/main.cpp b/src/main.cpp
> index d8e2a47..7a1b976 100644
> --- a/src/main.cpp
> +++ b/src/main.cpp
> @@ -356,7 +356,7 @@ int main(int argc, char **argv)
> int c;
> bool wantreport = FALSE;
> char filename[4096];
> - char workload[4096];
> + char workload[4096] = {0,};
> int iterations = 1;
>
> #ifndef DISABLE_TRYCATCH
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-06-27 18:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-27 8:17 [Powertop] [PATCH] prevent jump on uninitialized value Sergey Senozhatsky
-- strict thread matches above, loose matches on Subject: below --
2012-06-27 18:20 Chris Ferron
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.