Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10785165imu; Thu, 6 Dec 2018 06:47:42 -0800 (PST) X-Google-Smtp-Source: AFSGD/ULth+AL1abDx1GZscA4blzWSZOVoT4GMWcUwt6j/QX/jcSILQ4PqhnLouZbvAHXP/hKp19 X-Received: by 2002:a63:7cf:: with SMTP id 198mr24812535pgh.129.1544107662818; Thu, 06 Dec 2018 06:47:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544107662; cv=none; d=google.com; s=arc-20160816; b=IiHUT1L7Qtuy7traAArLTy1azjiH1BQwRujkdeNwXdzImPLkPhqt6MIogRstFTiUsC vNXn5NiAHI+ciqoC6jWwFyGD7rkno2Adfd+7x8TJ9nuT4E9NxDbJj7jXeWAg5hj8foX0 fMorjX2eu+wYpFebfYhrp+UQsH62Z6wUe6vIs+l/w6s0g+C1pWmBZ9DrTX8NeagrEBqk g7ezJ/dCLNurrG8SB4Fx1zv1Wzo6UlZFyySkMfVIGDk5a2ITUnjZFEBpWdB9K6mToJlF ENlgBhauNNRL9ndape9NQtvQFd1utlrYv3VZW8Vd87Mr8i3HEl0ZlwVb0mqND6adLFvy Olww== 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=HpQIdh9fv+X1hYoRqBvu79un3NQK9F5tBjeDlCMPLQ8=; b=MkpAKGn2tX9MzzOItXjEcGMnk1oxACSQgiRKFw3c5sBwe/kykCkIRDpaT9nUrHte59 uDCZRoH8YUyb/K6nVW1HmtNLRLSsa9BDSxRiAVlFzkoHN+81PascI98sKc7E5Lq5bpxI qlI/4TzRRWzocwVEIBEQQk/05LhULC6G2sm4prAktBRS7eAITRV9HlSWFAndwk0ARIvd NeT7XG3FDPyTmhYs/DGSJ5XnZk2PlasCP4nQQdgYp5A8GTMMU+aUvqqPGX+p/o0q4I4z vbw1WqEWBHEc2+BXE7ACU/JsHDkTKkQeYDKSP9THZRSS9nA6CIT7U3d9fbMJSt13dQQh llfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nRrFxhhT; 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 q10si414331pll.221.2018.12.06.06.47.26; Thu, 06 Dec 2018 06:47:42 -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=nRrFxhhT; 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 S1730813AbeLFOoI (ORCPT + 99 others); Thu, 6 Dec 2018 09:44:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:48626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730209AbeLFOoD (ORCPT ); Thu, 6 Dec 2018 09:44:03 -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 2171820661; Thu, 6 Dec 2018 14:44:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544107442; bh=tN9s3rO3hJIZPU3zYjWeCebcgQfHfyUb7pwWtc3Pu7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nRrFxhhTI+JO+3EcLgNww6egthvefisJ7czojl+br7lAVbkuuM80ARB0f2/ODkXpA aqsT99xTpVlhXMYDKSkLR83UZgMhXOwxlQFNFo2x5eP8bX1QNq9HJKd/HjWPsWTmPr q4rdVOiAzpgJv+qqh0Qh0T+ETDEuuwaArO16AXlU= 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.14 54/55] net: qed: use correct strncpy() size Date: Thu, 6 Dec 2018 15:39:28 +0100 Message-Id: <20181206143004.650713862@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181206143001.749982936@linuxfoundation.org> References: <20181206143001.749982936@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.14-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 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/drivers/net/ethernet/qlogic/qed/qed_debug.c +++ b/drivers/net/ethernet/qlogic/qed/qed_debug.c @@ -3590,10 +3590,8 @@ static u32 qed_grc_dump_big_ram(struct q total_blocks = big_ram->num_of_blocks[dev_data->chip_id]; ram_size = total_blocks * BIG_RAM_BLOCK_SIZE_DWORDS; - strncpy(type_name, big_ram->instance_name, - strlen(big_ram->instance_name)); - strncpy(mem_name, big_ram->instance_name, - strlen(big_ram->instance_name)); + strscpy(type_name, big_ram->instance_name, sizeof(type_name)); + strscpy(mem_name, big_ram->instance_name, sizeof(mem_name)); /* Dump memory header */ offset += qed_grc_dump_mem_hdr(p_hwfn,