Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754858AbcCBM7H (ORCPT ); Wed, 2 Mar 2016 07:59:07 -0500 Received: from casper.infradead.org ([85.118.1.10]:34106 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751536AbcCBM7F (ORCPT ); Wed, 2 Mar 2016 07:59:05 -0500 Date: Wed, 2 Mar 2016 13:59:01 +0100 From: Peter Zijlstra To: Colin King Cc: Ingo Molnar , Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org Subject: Re: [PATCH] perf tests: initialize sa.sa_flags Message-ID: <20160302125901.GF6356@twins.programming.kicks-ass.net> References: <1456923322-29697-1-git-send-email-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1456923322-29697-1-git-send-email-colin.king@canonical.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 967 Lines: 36 On Wed, Mar 02, 2016 at 12:55:22PM +0000, Colin King wrote: > From: Colin Ian King > > 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 > --- > 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 >