Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp3893138ooa; Mon, 13 Aug 2018 20:47:41 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyrfPZdIB11fFuT95E+4ITHywHTGfSHku0TO7rmX3TgOZhweeGlnhUA9S7uSO+wSTbM4Pra X-Received: by 2002:a63:175b:: with SMTP id 27-v6mr19198962pgx.31.1534218461180; Mon, 13 Aug 2018 20:47:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534218461; cv=none; d=google.com; s=arc-20160816; b=DfPlaQ/BT7719sATmNsBCc71qBGARFj213yGCvz/9sDe5d+THIrOEvDs4yjoUHUE1E 0mb3UIW4IN9dWUSks5Wq2YqSoBw3zGkZw21Jm+TJ1N+hugTK9zdv9hbJgObPJTS1vF0V FOLWA+cKDBGlFXqp+EuHa/quag96IhkvOO+4aow0y6NVM7zd4XgQ1Y09DfQZeuA3FU0n RZP0nUNIxnHHKLtjhfvQiYKnGhICbbDgUUgI0M6XRY5jJ9YaFF303COrJwk2gV8Yo17r E2xIRvkc/MGu+duaEFnms0fMIO08auUw5oKPRD2WSU6pOFZQc83Bi3ef2ZyXF0/xzqEy UA2w== 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:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date :arc-authentication-results; bh=9xLFffPUzZpkIaLL1ku5cJtnRjv/bJETkGLBqdfzF2c=; b=jPpPuf6Df3qgXg67HXQEQAJsVy1IQPt17/yt9Xiab2ISt2agzqQoQQByLNj0tR27bU YvcYhZR3okViDqCm2VH1y8Txv6W7ZHhvPUvMVrHJ+zk/omBPkuch7GF04rdopoh/Z18T w/JuDMoIlrDZsTMMdVJQ8QcoaJdR/1PN0O9CMWfn54LvbQaTsI5TrYRIPn27ZbfAHKi5 ZQEkYnyVHDMvFpfRbQzdE7lIsB2e1H6ElKBKpghoihO3G+3WwxjSlF9aDcZsGoigjEgx eNrr2extKGiQ64XwOAIM8+0GiTfO0VhN1ggj0sWJC+5KxjIUzwYwLUyqayGF9TFsUxrm s0Ew== 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 x1-v6si15223377pln.336.2018.08.13.20.47.26; Mon, 13 Aug 2018 20:47:41 -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 S1731140AbeHNGbq (ORCPT + 99 others); Tue, 14 Aug 2018 02:31:46 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:38172 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbeHNGbp (ORCPT ); Tue, 14 Aug 2018 02:31:45 -0400 Received: from localhost (unknown [172.58.41.230]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id DAC9912173DBF; Mon, 13 Aug 2018 20:46:31 -0700 (PDT) Date: Mon, 13 Aug 2018 20:46:30 -0700 (PDT) Message-Id: <20180813.204630.1588025496006675499.davem@davemloft.net> To: arnd@arndb.de Cc: michael.chan@broadcom.com, vasundhara-v.volam@broadcom.com, scott.branden@broadcom.com, gospo@broadcom.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] bnxt_en: avoid string overflow for record->system_name From: David Miller In-Reply-To: <20180813212700.2681499-1-arnd@arndb.de> References: <20180813212700.2681499-1-arnd@arndb.de> X-Mailer: Mew version 6.7 on Emacs 26 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Mon, 13 Aug 2018 20:46:32 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann Date: Mon, 13 Aug 2018 23:26:54 +0200 > The utsname()->nodename string may be 64 bytes long, and it gets > copied without the trailing nul byte into the shorter record->system_name, > as gcc now warns: > > In file included from include/linux/bitmap.h:9, > from include/linux/ethtool.h:16, > from drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:13: > In function 'strncpy', > inlined from 'bnxt_fill_coredump_record' at drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:2863:2: > include/linux/string.h:254:9: error: '__builtin_strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation] > > Using strlcpy() at least avoids overflowing the destination buffer > and adds proper nul-termination. It may still truncate long names > though, which probably can't be solved here. > > Fixes: 6c5657d085ae ("bnxt_en: Add support for ethtool get dump.") > Signed-off-by: Arnd Bergmann Applied.