Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp638014ybe; Wed, 11 Sep 2019 02:19:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxB8j/YuVa0CWRjuaDfz89beh/ZCDv70zVo/2nRQbDyM9rTwNp6uLYgINn/m7mx6I0I+Yry X-Received: by 2002:a50:ed89:: with SMTP id h9mr35171095edr.217.1568193582901; Wed, 11 Sep 2019 02:19:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568193582; cv=none; d=google.com; s=arc-20160816; b=PDXbq6TCNS+EPTkXqIWoo14YoXXqQKu6wAGUdtz25OYumOJD1N7LQbl8yJV8W+Y3DL m0EhdaMSWby84gC6JjB8fEuoBTQ0ya8d6xxbMXTqTS08D+aQW5OQ1ETd6dQfWE0vs97c KUux7gRozUwzmEuwnXT5ulBWwGuywevHrNnPArj1m5DI0VG4AhecYx5imF75AGFSlsFZ uSH6ThFzQ8N6/7Yk2MhpzJ2qS9mpk9B2JGWoRSKqXujzf1WB58gjZ/qTapwfnUc0HedS lQBvtnLLU4e8Z2K/2kOgcHtO2a0enUmqjK7HzEsSMKpkKLDbBd0eCp9yR/uREOEUouit ADFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zrFAZD9A5dGz2+B318YMzx/6IL2OQM9UN9vWaQkSluw=; b=aQCHfJ1E8W6HQxZfvBwwN/NY3dSeoQkYtc8sCP5hIaJ/mAJyKOjpBLwePsR/2O7RpJ ux149Dx+uDulgWs3lbBKqzid0g9sJ1rNiGGtMRHYQo5ra4aX/2dqeRMDmy73J3O0H+hn 5g2wU7foz3DrQlyNBb0FOdu2nd2DtaZBdvq2Ba0w7/QiZJJI/6NCqHw4gJX6WXzCKNcp XxcafS6opwWT1qyZaskgPKgteXebQC3zMgxjGM0sr23gWHQiZluTjJJr0+tM13vpMQkK fJN5XNC+SiZgQo5vAHdQKFFZeb156ypYFK3F1DKqhbOO02em7ciOIRsj771JjsF5Ynv7 +i2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=PpOdGDMl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2si12333315edc.321.2019.09.11.02.19.18; Wed, 11 Sep 2019 02:19:42 -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=@oracle.com header.s=corp-2019-08-05 header.b=PpOdGDMl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727302AbfIKJRd (ORCPT + 99 others); Wed, 11 Sep 2019 05:17:33 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:42652 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725616AbfIKJRc (ORCPT ); Wed, 11 Sep 2019 05:17:32 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x8B99LT8057317; Wed, 11 Sep 2019 09:17:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : content-transfer-encoding : in-reply-to; s=corp-2019-08-05; bh=zrFAZD9A5dGz2+B318YMzx/6IL2OQM9UN9vWaQkSluw=; b=PpOdGDMl3XXCdBFHPow6gWL+3GVNU2Y8XwCJCRLXbh7+jqCTJhDdevSYFf4sP+jCNCGX PZl8yhYY11j/KBwnkY1MxfB4YtsKv7t4mPTDkjeHoXR/BIYLI3oAF3l9uUpvlAKVUK1D QvvAgcPw/kfQP8kcrMRRC8YopU2+AL/GsLrxjylo0BFloYWxC/8FCsZ5Z72DRXJuyKoX 3wkxBlDS/9LOUNLD+TxxE++CDkkDHhCaSPFwyr5jLatFNDeYZFIt933Kk3BvoBZ0/PSa OvYrIFcgw3/BClJcJ6U/SbR2LxMVuaO/SB35DkvjRT34dhXCq0UzPZgfnRdecjpCnyDY 6A== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 2uw1jy8mbc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Sep 2019 09:17:11 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x8B999YH069125; Wed, 11 Sep 2019 09:17:10 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 2uxj88k493-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Sep 2019 09:17:10 +0000 Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x8B9H8CA012840; Wed, 11 Sep 2019 09:17:09 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 11 Sep 2019 02:17:08 -0700 Date: Wed, 11 Sep 2019 12:16:59 +0300 From: Dan Carpenter To: Sandro Volery Cc: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org, davem@davemloft.net, linux-kernel@vger.kernel.org, aaro.koskinen@iki.fi Subject: Re: [PATCH] Staging: octeon: Avoid several usecases of strcpy Message-ID: <20190911091659.GI15977@kadam> References: <20190911084956.GH15977@kadam> <39D8B984-479C-42D5-8431-9FF7BD3A96D6@volery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <39D8B984-479C-42D5-8431-9FF7BD3A96D6@volery.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9376 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1909110088 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9376 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1909110088 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 11, 2019 at 11:04:38AM +0200, Sandro Volery wrote: > > > > On 11 Sep 2019, at 10:52, Dan Carpenter wrote: > > > > On Wed, Sep 11, 2019 at 08:23:59AM +0200, Sandro Volery wrote: > >> 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)); > > > > Is there a program which is generating a warning for this code? We know > > that "pow%d" is 6 characters and static analysis tools can understand > > this code fine so we know it's safe. > > Well I was confused too but checkpatch complained about > it so I figured I'd clean it up quick Ah. It's a new checkpatch warning. I don't care in that case. I'm fine with replacing all of these in that case. regards, dan carpenter