Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1051470ybm; Tue, 21 May 2019 07:58:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqzsd6RLuQBhD8HQ0K+qgve+KSPXUZRXVw9BzW2VmoT0SkYztvgMLSnbbH5cJ5VrldIGDntQ X-Received: by 2002:aa7:80d9:: with SMTP id a25mr2546768pfn.50.1558450680313; Tue, 21 May 2019 07:58:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558450680; cv=none; d=google.com; s=arc-20160816; b=J4qB7bjT2AZzcEDFQ4VppaM1GMFYASqPmPB9mmFxCo2zqH8O7Lp/DttdPrSK8a4NoX c+hEQSutYRjHGS305sDtb2/bgWE8800SMmxzXBxoyd60FWhYV97WkFSzqK9kPQbYAHeg N3hqDvq/Gc6EZPjULk8H8Y0tn3BOVTZLJi8OhpmHXl3/nE0SBD7jUZl+kKM469nwfEUD XfvPeUc5GvAdw2C0gK6v6twsoSXsD9ZbK5egq5Mu607jeUAGvcgnAU9zSL1amzxhe+3F M9AxdYZa1ohDVbtfKLrz92/LqBJKsmxegKa3eII1hepU/cEBqrVWJArYkdRIXr9HJPTn qMyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Y6AK7zSnSQXyeL/6kISH9e+hrSGEJPp2QaKnJlKpy2Y=; b=SA5HXFsxyKLVEpoCtdFsIMEuDVVXQYftnHUZySSxsOM784B8yFcEfo2Hj5zr5dtmnk WSnc0gbvFJNXWacKLWxVarm33KgNVH1M8+cPUtZo5cRFNyyooLkp6HDBVHaY6a3Ck7zQ Zwhg3qP5SRHmkIOugN1EWDqVKddGFFEacNglasPiVLbHrSCMcMBLrbWZ791kK4JGuZ0R FemIRz9VdWZUmgXOhUEKu1pOKtU2YK18IHMo/YDXJLHn7lnvq7anNKouGyOGT8tNkDA9 cmbdnsgVxiVoFSyc8LaxvocHJDZtvZmI3tH6KuLrDQMsqjR1EQMmexo1a530+B+kyTTG m2RQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v14si20266167plo.97.2019.05.21.07.57.45; Tue, 21 May 2019 07:58:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728371AbfEUO4h (ORCPT + 99 others); Tue, 21 May 2019 10:56:37 -0400 Received: from www62.your-server.de ([213.133.104.62]:52614 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727986AbfEUO4h (ORCPT ); Tue, 21 May 2019 10:56:37 -0400 Received: from [78.46.172.2] (helo=sslproxy05.your-server.de) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1hT6Bv-0002I1-KH; Tue, 21 May 2019 16:56:35 +0200 Received: from [178.197.249.20] (helo=linux.home) by sslproxy05.your-server.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1hT6Bv-000M6d-Cs; Tue, 21 May 2019 16:56:35 +0200 Subject: Re: [PATCH bpf] samples/bpf: suppress compiler warning To: Matteo Croce , xdp-newbies@vger.kernel.org, bpf@vger.kernel.org Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Alexei Starovoitov References: <20190520214938.16889-1-mcroce@redhat.com> From: Daniel Borkmann Message-ID: Date: Tue, 21 May 2019 16:56:34 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20190520214938.16889-1-mcroce@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.100.3/25456/Tue May 21 09:56:54 2019) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/20/2019 11:49 PM, Matteo Croce wrote: > GCC 9 fails to calculate the size of local constant strings and produces a > false positive: > > samples/bpf/task_fd_query_user.c: In function ‘test_debug_fs_uprobe’: > samples/bpf/task_fd_query_user.c:242:67: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 215 [-Wformat-truncation=] > 242 | snprintf(buf, sizeof(buf), "/sys/kernel/debug/tracing/events/%ss/%s/id", > | ^~ > 243 | event_type, event_alias); > | ~~~~~~~~~~~ > samples/bpf/task_fd_query_user.c:242:2: note: ‘snprintf’ output between 45 and 300 bytes into a destination of size 256 > 242 | snprintf(buf, sizeof(buf), "/sys/kernel/debug/tracing/events/%ss/%s/id", > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 243 | event_type, event_alias); > | ~~~~~~~~~~~~~~~~~~~~~~~~ > > Workaround this by lowering the buffer size to a reasonable value. > Related GCC Bugzilla: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83431 > > Signed-off-by: Matteo Croce Applied, thanks!