Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp490432ybe; Tue, 10 Sep 2019 23:27:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqxv0j+2bDoERgNJaqmHljgMb8La7hgcU/FFDVDE3w7GkRGTC9ir7YhTS7HJosZaf9WlnGbj X-Received: by 2002:a17:906:1d11:: with SMTP id n17mr28535949ejh.68.1568183237370; Tue, 10 Sep 2019 23:27:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568183237; cv=none; d=google.com; s=arc-20160816; b=m/KiI5S5HsK8dnZM2sDJEG56euG/4EmSN+rUWjV9ucg3DAUpN3fdNUredyIb0OFp88 ZFHo86ytmuB1JRU7Q0i9OIB3WLCaSjmzgl6pV+MneQwnG+nz3Cuaoj87hcBRKPSRzyv8 XXZJJ7d/kjJ1nOkV6ivb2CpDsycNPehonr0z0nrpOkjf/bUpsYaZqJVZxdJQvoBeeQsp y4unh4Oc62lbdq8jHN3eJsQ8MQ4LFD8s8CU5FhUJR+hbfZs7Lb407AkFAP541K24L8Yz xDFQeuckj+v0mQUe/mqAVRbrnl9hIr5W240AG1070YR5jALH2q/71FJCOztBabqRq1JU ZoPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:to:from:date; bh=cV0cS9KQOit/3iCCXyJDn7p6ugTWXQSg3GOPbehuR2k=; b=ZtZfbKcQVhhBv2lL8+UZ93cFJZWXdALuqLPkBlA6KiGbUAF1uR8eDTvkAA7REa1HPO dOAkFTSdB367dXZqPJGqJNhjx6D+xX9I3w6EY/LI7en+oS1JdWE5qAClMuKP8E4WiMFP 7A/oR/HpgQQ4qpMKBFKKoutYn7bmM5BzRosi7eD2SnjkaXwSvkoBnYQOdWdy/1YCpAdr deYT1h8c50AV1LBsocl482sfXresU/4wxa9337cVz2e0eikJLOmHVUixaRDWWnCz5k/w 8M5An8Ms8SGFleG/o0PWja8T925u5TPIO6jdfjTcKDTFCd7X4WV/MSKp5cCTLxQi2tTA 73bg== 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 v53si12607338edc.378.2019.09.10.23.26.53; Tue, 10 Sep 2019 23:27:17 -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 S1726847AbfIKGYI (ORCPT + 99 others); Wed, 11 Sep 2019 02:24:08 -0400 Received: from mxout017.mail.hostpoint.ch ([217.26.49.177]:59915 "EHLO mxout017.mail.hostpoint.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726791AbfIKGYI (ORCPT ); Wed, 11 Sep 2019 02:24:08 -0400 Received: from [10.0.2.46] (helo=asmtp013.mail.hostpoint.ch) by mxout017.mail.hostpoint.ch with esmtp (Exim 4.92.2 (FreeBSD)) (envelope-from ) id 1i7w2r-000P9p-GC; Wed, 11 Sep 2019 08:24:01 +0200 Received: from [83.150.61.156] (helo=volery) by asmtp013.mail.hostpoint.ch with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2 (FreeBSD)) (envelope-from ) id 1i7w2r-0005Mp-An; Wed, 11 Sep 2019 08:24:01 +0200 X-Authenticated-Sender-Id: sandro@volery.com Date: Wed, 11 Sep 2019 08:23:59 +0200 From: Sandro Volery To: gregkh@linuxfoundation.org, davem@davemloft.net, aaro.koskinen@iki.fi, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] Staging: octeon: Avoid several usecases of strcpy Message-ID: <20190911062359.GA14886@volery> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org strcpy was used multiple times in strcpy to write into dev->name. I replaced them with strscpy. Signed-off-by: Sandro Volery --- drivers/staging/octeon/ethernet.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c index 8889494adf1f..cf8e9a23ebf9 100644 --- a/drivers/staging/octeon/ethernet.c +++ b/drivers/staging/octeon/ethernet.c @@ -784,7 +784,7 @@ static int cvm_oct_probe(struct platform_device *pdev) priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED; priv->port = CVMX_PIP_NUM_INPUT_PORTS; priv->queue = -1; - strcpy(dev->name, "pow%d"); + strscpy(dev->name, "pow%d", sizeof(dev->name)); for (qos = 0; qos < 16; qos++) skb_queue_head_init(&priv->tx_free_list[qos]); dev->min_mtu = VLAN_ETH_ZLEN - mtu_overhead; @@ -856,39 +856,39 @@ static int cvm_oct_probe(struct platform_device *pdev) case CVMX_HELPER_INTERFACE_MODE_NPI: dev->netdev_ops = &cvm_oct_npi_netdev_ops; - strcpy(dev->name, "npi%d"); + strscpy(dev->name, "npi%d", sizeof(dev->name)); break; case CVMX_HELPER_INTERFACE_MODE_XAUI: dev->netdev_ops = &cvm_oct_xaui_netdev_ops; - strcpy(dev->name, "xaui%d"); + strscpy(dev->name, "xaui%d", sizeof(dev->name)); break; case CVMX_HELPER_INTERFACE_MODE_LOOP: dev->netdev_ops = &cvm_oct_npi_netdev_ops; - strcpy(dev->name, "loop%d"); + strscpy(dev->name, "loop%d", sizeof(dev->name)); break; case CVMX_HELPER_INTERFACE_MODE_SGMII: priv->phy_mode = PHY_INTERFACE_MODE_SGMII; dev->netdev_ops = &cvm_oct_sgmii_netdev_ops; - strcpy(dev->name, "eth%d"); + strscpy(dev->name, "eth%d", sizeof(dev->name)); break; case CVMX_HELPER_INTERFACE_MODE_SPI: dev->netdev_ops = &cvm_oct_spi_netdev_ops; - strcpy(dev->name, "spi%d"); + strscpy(dev->name, "spi%d", sizeof(dev->name)); break; case CVMX_HELPER_INTERFACE_MODE_GMII: priv->phy_mode = PHY_INTERFACE_MODE_GMII; dev->netdev_ops = &cvm_oct_rgmii_netdev_ops; - strcpy(dev->name, "eth%d"); + strscpy(dev->name, "eth%d", sizeof(dev->name)); break; case CVMX_HELPER_INTERFACE_MODE_RGMII: dev->netdev_ops = &cvm_oct_rgmii_netdev_ops; - strcpy(dev->name, "eth%d"); + strscpy(dev->name, "eth%d", sizeof(dev->name)); cvm_set_rgmii_delay(priv, interface, port_index); break; -- 2.23.0