Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp904618rwb; Thu, 8 Dec 2022 04:35:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf58eRJ1KLjjrAnr8hH2Cx1qtR/Vlth051A+ChgpmCvAFmAdTdK9t1TGq3dybBvdtPVgteG3 X-Received: by 2002:a17:902:9681:b0:189:9d01:929d with SMTP id n1-20020a170902968100b001899d01929dmr44378172plp.108.1670502921601; Thu, 08 Dec 2022 04:35:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670502921; cv=none; d=google.com; s=arc-20160816; b=vNQ8KWb8KbwpotUN9odZdf0TGMKeRV/xWCYGaOWZjrKQrgAM0Lve4gcDzPCHWrIWzN GL/sgWUnALWec3+PfN4omsuLqtyUp0uBtRa4J3CMDlROr5Dk1vaoMf+jkOME6UQMCcBZ aZv7EzjP1MYG4jNBnMkyWQuMowUjIJm0s70ncUYT3ZWmgD5Fd+OyifMfNH/V6TqIE59I u1kWbp+BdkG3kvj7/vkQmxS0/SLMxfaj9gon8mA7gBOOzEYo/aZoYr/u3xR87voTTBDS +22zMfChc1CBLHvmfSKm863+jwuliaKMAtgizKQyjqDoAwtebT/otTiPn8mHDA8eWm3V VhDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:message-id:date; bh=BhJXhoSlgmf2daKrsZnoPDsnDflLQhXkU6AWOrr9J/Q=; b=B0u5JFFpoCq/Cz4PYhoa6tjANWP3m907xfQsavK/m092rS4WArS3lnZnNm96BFF33u 5mx78Yu+OeBAjTKg5e09gMMuwOP74a/n1yy2P4H8foZF77T/zRhY8n7A/E8VsG35lgpD 0wSiR6Wsj+a/cIelYxEgelP7l74czZ6nTsIl0100uEUf+rBJ0el5lg4cSUiV7J1Kt9wa YYXhEDoA2q1Gc5cnChuGp362WpdZ60nwF6th7OS45G3lZ5OD/cjdcP1ChZ0vIpwvN0zi QINkCZ2f86NPr67p+w5lDVXYgr4LOlXMiYbCjEwbyAvYGfThzw1R0W3TiVOr16DV4zgG yf3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gm16-20020a17090b101000b00213b01e42adsi4082898pjb.42.2022.12.08.04.35.11; Thu, 08 Dec 2022 04:35:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229754AbiLHLzZ (ORCPT + 72 others); Thu, 8 Dec 2022 06:55:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230100AbiLHLzL (ORCPT ); Thu, 8 Dec 2022 06:55:11 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 488CE7DA48; Thu, 8 Dec 2022 03:55:10 -0800 (PST) Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4NSXdm6zRnz8RTZG; Thu, 8 Dec 2022 19:55:08 +0800 (CST) Received: from szxlzmapp01.zte.com.cn ([10.5.231.85]) by mse-fl1.zte.com.cn with SMTP id 2B8Bt26S010563; Thu, 8 Dec 2022 19:55:02 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp04[null]) by mapi (Zmail) with MAPI id mid14; Thu, 8 Dec 2022 19:55:06 +0800 (CST) Date: Thu, 8 Dec 2022 19:55:06 +0800 (CST) X-Zmail-TransId: 2b066391d09a7df2e6b2 X-Mailer: Zmail v1.0 Message-ID: <202212081955061873542@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , , , , , Subject: =?UTF-8?B?W1BBVENIIGxpbnV4LW5leHRdIG5ldC9saXF1aWRpbzogdXNlIHN0cnNjcHkoKSB0byBpbnN0ZWFkIG9mIHN0cm5jcHkoKQ==?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 2B8Bt26S010563 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 6391D09C.001 by FangMail milter! X-FangMail-Envelope: 1670500509/4NSXdm6zRnz8RTZG/6391D09C.001/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6391D09C.001/4NSXdm6zRnz8RTZG X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xu Panda The implementation of strscpy() is more robust and safer. That's now the recommended way to copy NUL terminated strings. Signed-off-by: Xu Panda Signed-off-by: Yang Yang --- drivers/net/ethernet/cavium/liquidio/octeon_console.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_console.c b/drivers/net/ethernet/cavium/liquidio/octeon_console.c index 28feabec8fbb..076e11f7cbec 100644 --- a/drivers/net/ethernet/cavium/liquidio/octeon_console.c +++ b/drivers/net/ethernet/cavium/liquidio/octeon_console.c @@ -247,8 +247,7 @@ static const struct cvmx_bootmem_named_block_desc struct cvmx_bootmem_named_block_desc, size)); - strncpy(desc->name, name, sizeof(desc->name)); - desc->name[sizeof(desc->name) - 1] = 0; + strscpy(desc->name, name, sizeof(desc->name)); return &oct->bootmem_named_block_desc; } else { return NULL; -- 2.15.2