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=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 568A2C43603 for ; Wed, 18 Dec 2019 11:36:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2B7932176D for ; Wed, 18 Dec 2019 11:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726141AbfLRLgp (ORCPT ); Wed, 18 Dec 2019 06:36:45 -0500 Received: from mx2.suse.de ([195.135.220.15]:36216 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725930AbfLRLgp (ORCPT ); Wed, 18 Dec 2019 06:36:45 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 6BDFEAA35; Wed, 18 Dec 2019 11:36:43 +0000 (UTC) Date: Wed, 18 Dec 2019 12:36:42 +0100 From: Petr Mladek To: Andrey Zhizhikin Cc: ast@kernel.org, daniel@iogearbox.net, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, andriin@fb.com, sergey.senozhatsky@gmail.com, wangkefeng.wang@huawei.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, Andrey Zhizhikin , Arnaldo Carvalho de Melo , Jiri Olsa Subject: Re: [PATCH] tools lib api fs: fix gcc9 compilation error Message-ID: <20191218113642.2hw5rx2t6f277b3b@pathway.suse.cz> References: <20191211080109.18765-1-andrey.zhizhikin@leica-geosystems.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191211080109.18765-1-andrey.zhizhikin@leica-geosystems.com> User-Agent: NeoMutt/20170912 (1.9.0) Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Wed 2019-12-11 08:01:09, Andrey Zhizhikin wrote: > GCC9 introduced string hardening mechanisms, which exhibits the error > during fs api compilation: > > error: '__builtin_strncpy' specified bound 4096 equals destination size > [-Werror=stringop-truncation] > > This comes when the length of copy passed to strncpy is is equal to > destination size, which could potentially lead to buffer overflow. > > There is a need to mitigate this potential issue by limiting the size of > destination by 1 and explicitly terminate the destination with NULL. > > Signed-off-by: Andrey Zhizhikin > Cc: Arnaldo Carvalho de Melo > Cc: Jiri Olsa Reviewed-by: Petr Mladek Best Regards, Petr