Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp265198ybi; Wed, 29 May 2019 20:59:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqxGd17BMRbmwMCf0b19u/DbfbmeVq9WVNXMA+CTvk8yaUFCx8ZX9vlKW8AUaSym352o1ZrZ X-Received: by 2002:a17:902:8305:: with SMTP id bd5mr1698672plb.339.1559188741422; Wed, 29 May 2019 20:59:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559188741; cv=none; d=google.com; s=arc-20160816; b=yJsOb4Bzc55eiV/HRmdDEmCr9X3acNg9sWxdIhgeKYZVc1CbU6KH7wPwa0wWpysdjH cvnIZIa3SF183+igHLCCKjYgwYalFvJdvg33f86gzXklT0wleWsILd9C6pBo0+AxnLbr T2fGHMSm0mJjQEWkvEmlMalpoZszpx5fLYDPjf7zlXFJv3YZN9XAa1O7p692OgMzqPu8 4fVhG54m0di/n+8IQOo/09ZCMs4scND2mnfAV5jg2v5Xu0DuYWq3ZtSj27Kbo9c/07mf g8K34SJm6Knu5WxeANqbE04ZprQqLUJd8rK+mbiHbVCjcy5s+62zTihu1Vv2tACoyqLF aaCg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OT8aYXR5uUBECpXwwUCz+cRprB9bzfZIgYire51vS10=; b=A9BwYmQSrEGfzuL3KketyvyE6b0Pul+uxmWozue2sYDU5H95QMH+ZaZm2adcb8ldan t4VLLP5F2stv/6/syfvo80Pbj/flpW6joK+5DmsR4Q7hgM9fHAkbBJuECbeX1YSPOM1b FHxC1uVHV3cCFa3h8FAred10luoebqSo03ojQEKIa/Pwdf6zopcNe9oLxvPWyYPPE/xl yIrwfmcd29I5iWIAFMrD/sy9kzgou8XBFYeorGH1injuSgFjiAUGaRHCyA8c/V2aONWj PtufnCJShHK7/MRjXOV0MgLm97Rw/qjqOZhCezejW51ZVEh4q65/xhRc/ok+rleef/X4 JbPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rqNnwFGJ; 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 i96si2235528plb.210.2019.05.29.20.58.46; Wed, 29 May 2019 20:59:01 -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; dkim=pass header.i=@kernel.org header.s=default header.b=rqNnwFGJ; 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 S1733021AbfE3D5g (ORCPT + 99 others); Wed, 29 May 2019 23:57:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:52696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731724AbfE3DSs (ORCPT ); Wed, 29 May 2019 23:18:48 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (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 5AFC62479B; Thu, 30 May 2019 03:18:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186328; bh=U6QRBARhgUq1qClnks2XAmFSTxuDMrCfnmBuBHfkHUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rqNnwFGJIaOd4KfXGuyBjMwsvwmTuui1lbekDmilgWEip79KeSAQrfYMlpjg8zF4Z C+6zmpxShMHMn/sWeVHXhrr8RUIomO5ef9aCneVjNi3JOEesNsJIB6Z6/v3UPCOj3p GPLjysf+aC1Gi3aWVgAau/Uwr0gidZfi+0j2JBGo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sameeh Jubran , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 044/193] net: ena: gcc 8: fix compilation warning Date: Wed, 29 May 2019 20:04:58 -0700 Message-Id: <20190530030455.777703122@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030446.953835040@linuxfoundation.org> References: <20190530030446.953835040@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit f913308879bc6ae437ce64d878c7b05643ddea44 ] GCC 8 contains a number of new warnings as well as enhancements to existing checkers. The warning - Wstringop-truncation - warns for calls to bounded string manipulation functions such as strncat, strncpy, and stpncpy that may either truncate the copied string or leave the destination unchanged. In our case the destination string length (32 bytes) is much shorter than the source string (64 bytes) which causes this warning to show up. In general the destination has to be at least a byte larger than the length of the source string with strncpy for this warning not to showup. This can be easily fixed by using strlcpy instead which already does the truncation to the string. Documentation for this function can be found here: https://elixir.bootlin.com/linux/latest/source/lib/string.c#L141 Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)") Signed-off-by: Sameeh Jubran Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c index 3c7813f04962b..db6f6a877f630 100644 --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c @@ -2229,7 +2229,7 @@ static void ena_config_host_info(struct ena_com_dev *ena_dev) host_info->os_type = ENA_ADMIN_OS_LINUX; host_info->kernel_ver = LINUX_VERSION_CODE; - strncpy(host_info->kernel_ver_str, utsname()->version, + strlcpy(host_info->kernel_ver_str, utsname()->version, sizeof(host_info->kernel_ver_str) - 1); host_info->os_dist = 0; strncpy(host_info->os_dist_str, utsname()->release, -- 2.20.1