From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752650AbcLFLJ7 (ORCPT ); Tue, 6 Dec 2016 06:09:59 -0500 Received: from foss.arm.com ([217.140.101.70]:35692 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751139AbcLFLJ6 (ORCPT ); Tue, 6 Dec 2016 06:09:58 -0500 Date: Tue, 6 Dec 2016 11:09:05 +0000 From: Mark Rutland To: Kefeng Wang Cc: linux-kernel@vger.kernel.org, Dmitry Vyukov , Andrey Ryabinin , James Morse , Andrew Morton Subject: Re: [PATCH] kcov: add missing #include Message-ID: <20161206110905.GA24177@leverpostej> References: <1481007384-27529-1-git-send-email-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1481007384-27529-1-git-send-email-wangkefeng.wang@huawei.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 06, 2016 at 02:56:24PM +0800, Kefeng Wang wrote: > It is needed by struct task_struct, fixes the following build problem > with old gcc: > > ../kernel/kcov.c: In function ‘__sanitizer_cov_trace_pc’: > ../kernel/kcov.c:66: error: dereferencing pointer to incomplete type > ...... > ../kernel/kcov.c:239: error: dereferencing pointer to incomplete type > It's somewhat confusing to strip the useful part of the error message (which mentions task struct). How about: In __sanitizer_cov_trace_pc we use task_struct and fields within it, but as we haven't included , it is not guaranteed to be defined. While we usually happen to acquire the definition through a transitive include, this is fragile (and hasn't been true in the past, causing issues with backports). Include to avoid any fragility. Either way this looks like a sensible fix/cleanup, so FWIW: Acked-by: Mark Rutland It looks like we're missing some other headers (e.g. for EXPORT_SYMBOL(), for preempt_count() and friends). It may be worth fixing all of those at once. Thanks, Mark. > Signed-off-by: Kefeng Wang > --- > > note: > - Build error occurred when I backported kcov to an old kernel version > with an old gcc > > kernel/kcov.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/kernel/kcov.c b/kernel/kcov.c > index 30e6d05..3cbb0c8 100644 > --- a/kernel/kcov.c > +++ b/kernel/kcov.c > @@ -7,6 +7,7 @@ > #include > #include > #include > +#include > #include > #include > #include > -- > 1.7.12.4 >