Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp615537ybe; Wed, 11 Sep 2019 01:57:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzUMtkP9YaWtRt/JmDWoz1d38iGmxfGmT/u0A97IcjrUXZBFz5fOESrBBms9iQYenFiZ6gO X-Received: by 2002:a17:906:7fd7:: with SMTP id r23mr28584040ejs.182.1568192224517; Wed, 11 Sep 2019 01:57:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568192224; cv=none; d=google.com; s=arc-20160816; b=sVWCjYrKJh1pb99eMXJXnSWd4L61tBuWM4xB9JAg6/mS5Yrc7z+dLfk5xzvZBUhzUu PQkQdYAFFt/ybx2JMp1zdfx4+wdCXOzvKUbeEDvaYROsmjo2z3qdukKGDVvbabGgKh/q /J14K8Bw4EsoBKQ+GfKg0jxvaNhjvFLJJWtW0OesCm/E57fRFK5ytqsRnY82bKOrT1Rw GwLs8SeG7Z08NKxXaTAUfzIGkvd5xCykhB8aVFkgCJul7mo62sZr0O1gIAJlfM0uNJLf acgHtejihJXuXd/49pUDZ+yfEVAaZfo/pfV0/r0uR/zh88BEtOtCabVrjq0z5BPUV9GY cafQ== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=9q4LtJAqv0F0QoJlz3XTDUNIJczhe+LxSRL/PZPmYSg=; b=AmjL6Yq91P8ohNF6gDH4ikCyMiOSiqnQvDETEkInX91qUVV5OqE9+mPEVOBcyaHLIz 9sPZAd0VuDdycnOT5/ObdNFEtOUWE6+fIkLpaUXVoWC2yeeP1hHEakALjayB1gzD7Mg9 QppFK/O0qA5wIWdBC0xIZtU6nqtbDIeVPyhr73zmZWJgR9RfFaxb4DqllK1iNghxn8lY NztmcsujG7z7Bm3WK57e+NDS5ZCOxz38MUztqUbcAdg3bkkqnHgAONyNygLoAP5EkNH5 yt4X91YFQYBrjt7hv6tgw29y13MfDagIZ26usUzDtH9f6jWMpi9RiDxxV5OtD1IIeJjL f6Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=L2GBadGJ; 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 d20si10981615ejc.302.2019.09.11.01.56.40; Wed, 11 Sep 2019 01:57:04 -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=L2GBadGJ; 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 S1727221AbfIKIwZ (ORCPT + 99 others); Wed, 11 Sep 2019 04:52:25 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:46568 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727138AbfIKIwZ (ORCPT ); Wed, 11 Sep 2019 04:52:25 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x8B8meLM097263; Wed, 11 Sep 2019 08:52:14 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 : in-reply-to; s=corp-2019-08-05; bh=9q4LtJAqv0F0QoJlz3XTDUNIJczhe+LxSRL/PZPmYSg=; b=L2GBadGJQHoW78Jp6NDSKabKAFE/p2MummzFJ94mxtzDuql2oH4YNTSUwd4MzC96NUP3 0GBIwotwBC7xFfWfVhxKvIxBoLN8NPxuScODyS4gRaC6MZlOomnOy8aASOufMcIEfipJ XKMYPQmGMJ85p+5CBOucLss/TZbme5Xca/azhLHaJKYWA2y76aGsxht4OXpJtyuFlVol yB/pVmolTI5H5uQkC/SrDaXqKD+lWqGXQhfdPnvnZwuKYyveuu6LdOGOx6315AIVS8OA akOkDfmUFtm9OOgr6OI/vj0ftm9Ntz3wedlB20vCzC4tmXwsbC+r9aWqIdj9G17Eiwmo uQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 2uw1m90hyu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Sep 2019 08:52:13 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x8B8m5Ng025016; Wed, 11 Sep 2019 08:50:13 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 2uxk0t0gy1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Sep 2019 08:50:13 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x8B8o423027882; Wed, 11 Sep 2019 08:50:05 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 11 Sep 2019 01:50:04 -0700 Date: Wed, 11 Sep 2019 11:49:56 +0300 From: Dan Carpenter To: Sandro Volery Cc: gregkh@linuxfoundation.org, davem@davemloft.net, aaro.koskinen@iki.fi, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Staging: octeon: Avoid several usecases of strcpy Message-ID: <20190911084956.GH15977@kadam> References: <20190911062359.GA14886@volery> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190911062359.GA14886@volery> 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-1909110084 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=1011 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-1909110084 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 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. regards, dan carpenter