Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10785242imu; Thu, 6 Dec 2018 06:47:48 -0800 (PST) X-Google-Smtp-Source: AFSGD/XiOS+Np4ChEpOFcSELYxUOJ3n3iQAymwOhcKxDyPH+X1WMu08mEbKXg3p4RD8XjPM3vTaf X-Received: by 2002:a63:7d06:: with SMTP id y6mr24233682pgc.171.1544107668098; Thu, 06 Dec 2018 06:47:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544107668; cv=none; d=google.com; s=arc-20160816; b=Ns0QWFJn5bqhv/eubPNGjGmPEe1bTa+eS1kkm40uYYs/oEEEtm7pkpwmMLeCQTK6JC bewGZG8jvEtcaEnn44/8VHXqzKZtv0+5l2fuQo7z0RjK5hYU/khrpCYp0b1F5OJrLXaW ky04MHoARVtYGQIxC0P6HBadqSWVjN1j6w+YYra5DmTqPUnoN1iWsxZ5fy27LOD74o2G CHNK/kgkQu6CoJcdUALCGUd8pU6WcfVXifor/ksq9MR2mB3DPe836gU9ly0koNZ5fMUz tRDyRsld73cUINbA/8x00fqq7hur1gaqI0eSATRtgbqNahb3+1k2V+wlmyDN2e+FKwef YTqQ== 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=tZTzhH3MlUXFpt5kNfUAJhLitfUhbadhEhCTFApGEnk=; b=TRXbDpSwcw+Z2PrkUrtHDITkVRaVKxb7KX9oycS2uYeiQ0X+VP4UIizsVI9WDdHa8A SMUi/kJC9EHV25EkKAxpTrQy8JPA+DMck3Rh8WYwsm4922K8WAkEOPdIFquXkwt6Osyo N1aWwIs3zzBNHmabs5CCxDE+yOrcLkwrvcuRYZaGI++HAsLr09HKKu0H9DjC9NhCAMyb fAr7wbC5j52qC37YuJdjScIwVaEFdBW540zOiYmgJ4u6BhCwCZ+RYPGecxUF28TFrsVb qWavLmyhJGxGeVUgXp6Np/vZ0hfIUiTsfR/r/EHzJyByWVmUAaN0pRNUHECSZNzeuhEb hkfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vey5fLCx; 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 bj11si423713plb.21.2018.12.06.06.47.31; Thu, 06 Dec 2018 06:47:48 -0800 (PST) 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=vey5fLCx; 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 S1731131AbeLFOpq (ORCPT + 99 others); Thu, 6 Dec 2018 09:45:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:50414 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730611AbeLFOpm (ORCPT ); Thu, 6 Dec 2018 09:45:42 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 186D9214DB; Thu, 6 Dec 2018 14:45:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544107541; bh=cOHVre9zVpu4fYdKeA3e04p+ZQQmdJz2+K4sbHdrIw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vey5fLCxfGjnKtHHGFRnupGJCaQyOfjeq0hzb2QIKVIRSDlrBKSxx4xjC96iuOfqW 7A91jinlREhBSsftC2H9sO7/DICWNPsYzlciF7X3VRlZhU21/eClbJfHn2Hbu/J1e7 i7yBDrCD8Ek0e7Gjet1EPOvktnW73PAWcQ8xBaIE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , "David S. Miller" Subject: [PATCH 4.9 046/101] net: qed: use correct strncpy() size Date: Thu, 6 Dec 2018 15:38:45 +0100 Message-Id: <20181206143014.187379095@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181206143011.174892052@linuxfoundation.org> References: <20181206143011.174892052@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arnd Bergmann commit 11f711081af0eb54190dc0de96ba4a9cd494666b upstream. passing the strlen() of the source string as the destination length is pointless, and gcc-8 now warns about it: drivers/net/ethernet/qlogic/qed/qed_debug.c: In function 'qed_grc_dump': include/linux/string.h:253: error: 'strncpy' specified bound depends on the length of the source argument [-Werror=stringop-overflow=] This changes qed_grc_dump_big_ram() to instead uses the length of the destination buffer, and use strscpy() to guarantee nul-termination. Signed-off-by: Arnd Bergmann Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/qlogic/qed/qed_debug.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/net/ethernet/qlogic/qed/qed_debug.c +++ b/drivers/net/ethernet/qlogic/qed/qed_debug.c @@ -3039,10 +3039,10 @@ static u32 qed_grc_dump_big_ram(struct q s_big_ram_defs[big_ram_id].num_of_blocks[dev_data->chip_id]; ram_size = total_blocks * BIG_RAM_BLOCK_SIZE_DWORDS; - strncpy(type_name, s_big_ram_defs[big_ram_id].instance_name, - strlen(s_big_ram_defs[big_ram_id].instance_name)); - strncpy(mem_name, s_big_ram_defs[big_ram_id].instance_name, - strlen(s_big_ram_defs[big_ram_id].instance_name)); + strscpy(type_name, s_big_ram_defs[big_ram_id].instance_name, + sizeof(type_name)); + strscpy(mem_name, s_big_ram_defs[big_ram_id].instance_name, + sizeof(mem_name)); /* Dump memory header */ offset += qed_grc_dump_mem_hdr(p_hwfn,