From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EC27C433C1 for ; Tue, 23 Mar 2021 12:58:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D718D619B7 for ; Tue, 23 Mar 2021 12:58:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231376AbhCWM6W (ORCPT ); Tue, 23 Mar 2021 08:58:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:41500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231486AbhCWM5p (ORCPT ); Tue, 23 Mar 2021 08:57:45 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 21011619B9; Tue, 23 Mar 2021 12:57:44 +0000 (UTC) Date: Tue, 23 Mar 2021 08:57:42 -0400 From: Steven Rostedt To: Peter Zijlstra Cc: Arnd Bergmann , Ingo Molnar , Arnd Bergmann , Adrian Hunter , Tobias Klauser , Wei Yang , Chengming Zhou , "Naveen N. Rao" , "Paul E. McKenney" , linux-kernel@vger.kernel.org, Kees Cook Subject: Re: [PATCH] ftrace: shut up -Wcast-function-type warning for ftrace_ops_no_ops Message-ID: <20210323085742.18477aad@gandalf.local.home> In-Reply-To: References: <20210322215006.1028517-1-arnd@kernel.org> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 23 Mar 2021 08:39:08 +0100 Peter Zijlstra wrote: > > index 4d8e35575549..d8fc87a17421 100644 > > --- a/kernel/trace/ftrace.c > > +++ b/kernel/trace/ftrace.c > > @@ -125,7 +125,7 @@ static void ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, > > #else > > /* See comment below, where ftrace_ops_list_func is defined */ > > static void ftrace_ops_no_ops(unsigned long ip, unsigned long parent_ip); > > -#define ftrace_ops_list_func ((ftrace_func_t)ftrace_ops_no_ops) > > +#define ftrace_ops_list_func ((ftrace_func_t)(void *)ftrace_ops_no_ops) > > So now we're making perfectly fine code worse, because GCC is stupid? > > Please just kill the warning, like we do with so many other warnings. > It's broken! [ Adding Kees ] Well, from what I understand is that typecasting functions to other types of functions is one of the mistakes that cause security bugs to happen. And there's been a few of them in the kernel. Which is why the compilers have now been flagging them. This particular instance of the typecasting is unique and there's a bit of magic involved. Adding this little work around here is fine. Probably needs a better comment though. -- Steve