lkml.org 
[lkml]   [2016]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] perf tests: initialize sa.sa_flags
On Wed, Mar 02, 2016 at 12:55:22PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The sa_flags field is not being initialized, so a garbage value is
> being passed to sigaction. Initialize it to zero.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> tools/perf/arch/x86/tests/rdpmc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/perf/arch/x86/tests/rdpmc.c b/tools/perf/arch/x86/tests/rdpmc.c
> index 7bb0d13..7945462 100644
> --- a/tools/perf/arch/x86/tests/rdpmc.c
> +++ b/tools/perf/arch/x86/tests/rdpmc.c
> @@ -103,6 +103,7 @@ static int __test__rdpmc(void)
>
> sigfillset(&sa.sa_mask);
> sa.sa_sigaction = segfault_handler;
> + sa.sa_flags = 0;

Would not something like:

sa = (struct sigaction){
.sa_sigaction = segfault_handler,
};
sigfillset(&sa.sa_mask);

Be better?

> sigaction(SIGSEGV, &sa, NULL);
>
> fd = sys_perf_event_open(&attr, 0, -1, -1,
> --
> 2.7.0
>

\
 
 \ /
  Last update: 2016-03-02 14:41    [W:0.046 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site