From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0672B42C0E; Fri, 2 Jun 2023 08:05:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ED852406B8; Fri, 2 Jun 2023 08:05:56 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id A7D9540695 for ; Fri, 2 Jun 2023 08:05:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685685955; x=1717221955; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Ppe4P50/Kcg1U0aC/B8eNxlbQ/jQ+NbLDBM7UqzlQTU=; b=FbNab6FH7pwil9paUn0cpGZ9j7RTfWnwr+iPsiji1YPjW3YOTXj3V1sq AJ/KfNhcTFl91Oohzv1vtXY3OHxjbPML64mPB4Wqx8krwKuTd/OESWx7/ MMUgGbMj/Nmsroh/r5P5UB7CXYijQl02U2PSRqqx2gO/fULIRz9rLu1Kw LlGEDSVmMlMU5VF5p/iHaW36uXW+i2BdXRVt2ssJYcT/QkIipcWTKIzwc Nd9oO7JSp/kzu8TKpzXQU2bfyH+9ETtUbP17ht99ryQDqyE9AvdITCLxi Yl4cYU7O6MbdlXuGETT/QHf73bua1bCMoWZjQvfy8F2VAY4Kk4bDHiO/i w==; X-IronPort-AV: E=McAfee;i="6600,9927,10728"; a="345360494" X-IronPort-AV: E=Sophos;i="6.00,212,1681196400"; d="scan'208";a="345360494" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2023 23:05:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10728"; a="852001975" X-IronPort-AV: E=Sophos;i="6.00,212,1681196400"; d="scan'208";a="852001975" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga001.fm.intel.com with ESMTP; 01 Jun 2023 23:05:51 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 1 Jun 2023 23:05:47 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 1 Jun 2023 23:05:47 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Thu, 1 Jun 2023 23:05:47 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.175) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Thu, 1 Jun 2023 23:05:38 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ibX+cOAnzdFTTTPj0Ho/qzOhK8dCecKaoZ6FBzJVhsWkzwFJId8rsYrzjhcYh1uhPaJo98TEu6yFpoISDlgeY1vf9MhSQBGhrqXH2BpBdSoRoNhQGuw2bvFFfzAUNQc7OVRe+C9vqGXVAffbp3bnk9lTqJIHLK8tNwjl237L6yNw4bmXDWdBPa7aGkN9e4PBMqL3azhkOeJ9ghRYK9dOo89NhmOTqDK7IsfeIw6XnNjZCkt28mCkOBIbvoO2GqtRW21iUsZ4cNHG3UJI+m6xJXImXYddst/mwua+x1kukZobwhwEijS+xKjIE5ambPqfCAl9OF3prgcci5Evb2L1bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4KWqVekYnsEZykfiCTWlbHZOO+fQLXaRX9DCxh+FoP8=; b=W7MQsPJksizq+nS9zTvTj1idaF1mon8pZPmlMBo8bvB0WGEVDq15PZOm5uyvoADufi/voITN3kQBB6xL2C2ERAtQSVqeDQnN3V6LAc0HHtyUKJILDVMk3tuNBw1hSijdTIDhlYoEHr8rXFZhtYgGz4HnWZaxhYNUjkp2A6AMjOQoxOSYUSYSvBJCB3auSN8Owvtzh90ooR/ZibxGwhzhjlqpn3Z2FuCZFEHWgCfzLvcf/S9SlK52Bd4JAofwjl09pSFZHOKd7wObaYpiyztsUWXDDmhoxZlbQISVuaIaX9/PSs3A0D+MHfayaeDL0Nw9Gr/lzuy8aHnrZ32cZzEKhQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM6PR11MB4252.namprd11.prod.outlook.com (2603:10b6:5:201::26) by SA1PR11MB8328.namprd11.prod.outlook.com (2603:10b6:806:376::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.23; Fri, 2 Jun 2023 06:05:31 +0000 Received: from DM6PR11MB4252.namprd11.prod.outlook.com ([fe80::29af:3256:60ce:a172]) by DM6PR11MB4252.namprd11.prod.outlook.com ([fe80::29af:3256:60ce:a172%3]) with mapi id 15.20.6433.022; Fri, 2 Jun 2023 06:05:31 +0000 From: "Xu, Rosen" To: Stephen Hemminger , "dev@dpdk.org" CC: Andrew Boyer Subject: RE: [PATCH 20/25] net/ionic: replace snprintf with strlcpy Thread-Topic: [PATCH 20/25] net/ionic: replace snprintf with strlcpy Thread-Index: AQHZlJo2mwUfcTk+bU2lIISn+FXSMa93Bx1A Date: Fri, 2 Jun 2023 06:05:31 +0000 Message-ID: References: <20230601150106.18375-1-stephen@networkplumber.org> <20230601150106.18375-21-stephen@networkplumber.org> In-Reply-To: <20230601150106.18375-21-stephen@networkplumber.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM6PR11MB4252:EE_|SA1PR11MB8328:EE_ x-ms-office365-filtering-correlation-id: c3824cab-1218-4ccb-051a-08db632f5f14 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 3PKr629nU9mfpYhpjtdNutOOMbf380Zd7pAobXKh6NIPzt1XjgYxni8jDXZz1Bl7fdVTymIu85w9l6cZSo9EWfkFofwUTWRc6FFgI3jPGrfF6BUqOKYYMuvmP1bTtp+yfpVLfhPvmxEUvNl94fQro6/Kn4BeE2fHHVpLTgaEeK0ruT2nsrcG9vSvC3lj3OvS6cx00AT7xOpMZ7opFgP05W2G+lwssIZWeI16EnvIuWiFZ16LzVdEjvU0qs6EzemEtO2vk60q5eh5ffNEPdXJwm9gZkR9S6t9Ui13WF0wFRR+HZ4iSsWId1634P13G6I3RmoIzBIeC72VdR/Cpa3j9yvvwqMShwowb6W9Ey0PiHiGY/Ejb8zdmGyI3I2Kq5wzf21PiGcZm1OPP7b2PJT8d1neuu7V+MUHQdC0GuANQ0FQsoU4+dH1YJVV2MTcIAWnReFaBZUXEZgsZI04we/H7YVZYpFbVeJkY3jKkKKzCbg7U0Pk+PMgf3ljqQNH8HUsydJNAsrWQxNdjTMe3Z598YgmxF68lzpvfCfZqMkapoyI7tuNYZaaVJfOAgRlkubuC4GSB2pZn8Va5ZFY/aHJEahr5w6TzrePprXCgokjULcDPuOVgci+g8pqENallkEPXLkVVX4mKQqxqAVu62DA5A== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4252.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(396003)(136003)(376002)(346002)(366004)(39860400002)(451199021)(478600001)(55016003)(5660300002)(186003)(83380400001)(33656002)(52536014)(7696005)(86362001)(2906002)(8676002)(8936002)(4326008)(82960400001)(122000001)(41300700001)(316002)(38100700002)(38070700005)(6506007)(26005)(71200400001)(66556008)(66946007)(76116006)(9686003)(110136005)(64756008)(66476007)(66446008)(53546011)(156123004); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?xe8uLZJ5Cagp2a52hRatSWswNVj2JPvElYdMl3YulcGYzN31EKcPLcv5qtV2?= =?us-ascii?Q?V1SjrU95qV70lP5KiRgA95kdKbq8B67tMAXYcJfhZK/Z5gn2eSn1KE/1qEo0?= =?us-ascii?Q?Ha1eiCxO4xVa9KwYjEw+XjUoUkk8IpEw9AlxdiwNckxOLH1KDSHZOpizJLrw?= =?us-ascii?Q?RAOFrSHZ+MlfyJhkRmfyOvzk0alCUZNGkD5ZjVeXJ81+3dYOr0wc5hCcikd6?= =?us-ascii?Q?6zdwgdm3B2gC7+W4y71F6dQVQsyqfcASnfqrZgWAhFQNzWZ1yG7D7wOd3fyA?= =?us-ascii?Q?DlEHrt1mnwSHXuJVtiHqO3hu+YYGQZi9k1ezilzOrSz7bC09Sv/auCD2sMm4?= =?us-ascii?Q?VKnyANeRf7TxAassaWsAJEThxDvRQFCqHzGppJHdVk9N+E/tvReBnS2957dv?= =?us-ascii?Q?1aZnj/79K4C8DGwW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?us-ascii?Q?T+lSu+B41jCy/YfqQSbsO4RCf21D53hpG0fZrPMeMtTf9cL2vJLa2G5sBRo5?= =?us-ascii?Q?DTFcojVdM7f46xkTXGgz8t8N6e1tZ2Va8lkOcaGWKPvyoIbGrnvJaOdhwaYd?= =?us-ascii?Q?wT4pf8WXtIT5zZpW2Jh2J1ExW9kY0mht1z/JTo4Drf9ZiVzqJxaHP6Cgx0J3?= =?us-ascii?Q?AAnsA5n2sb5JkXrD04AxtcQgn9gF7ptqQQ+RsP44XXsT69AlpdssZgsv1bSb?= =?us-ascii?Q?MLvV4DlEtjCcjINqxyA=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4252.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3824cab-1218-4ccb-051a-08db632f5f14 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Jun 2023 06:05:31.2815 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: SiKXlIeSiGUJ0hlesnzTniicvAnH5prgATDUxWchf1//HehOpZAaTbjBwDl4rCH0rHyKsJADpwx9O07UgVtu7Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB8328 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi, > -----Original Message----- > From: Stephen Hemminger > Sent: Thursday, June 1, 2023 11:01 PM > To: dev@dpdk.org > Cc: Stephen Hemminger ; Andrew Boyer > ; Xu, Rosen > Subject: [PATCH 20/25] net/ionic: replace snprintf with strlcpy >=20 > Suggested by devtools/cocci/strlcpy-with-header.cocci >=20 > Signed-off-by: Stephen Hemminger > --- > drivers/net/ipn3ke/ipn3ke_representor.c | 17 +++++++---------- > diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c > b/drivers/net/ipn3ke/ipn3ke_representor.c > index e50fc73f43c4..feafe9679907 100644 > --- a/drivers/net/ipn3ke/ipn3ke_representor.c > +++ b/drivers/net/ipn3ke/ipn3ke_representor.c > @@ -124,8 +124,7 @@ ipn3ke_rpst_dev_start(struct rte_eth_dev *dev) > rawdev =3D hw->rawdev; >=20 > memset(attr_name, 0, sizeof(attr_name)); > - snprintf(attr_name, IPN3KE_RAWDEV_ATTR_LEN_MAX, "%s", > - "LineSideBaseMAC"); > + strlcpy(attr_name, "LineSideBaseMAC", > IPN3KE_RAWDEV_ATTR_LEN_MAX); > rawdev->dev_ops->attr_get(rawdev, attr_name, &base_mac); > rte_ether_addr_copy((struct rte_ether_addr *)&base_mac, > &rpst->mac_addr); > @@ -2330,19 +2329,17 @@ __rte_unused unsigned int limit) >=20 > /* Get stats from ipn3ke_rpst_stats */ > for (i =3D 0; i < IPN3KE_RPST_ETH_XSTATS_CNT; i++) { > - snprintf(xstats_names[count].name, > - sizeof(xstats_names[count].name), > - "%s", > - ipn3ke_rpst_stats_strings[i].name); > + strlcpy(xstats_names[count].name, > + ipn3ke_rpst_stats_strings[i].name, > + sizeof(xstats_names[count].name)); > count++; > } >=20 > /* Get individual stats from ipn3ke_rpst_hw_port */ > for (i =3D 0; i < IPN3KE_RPST_HW_PORT_XSTATS_CNT; i++) { > - snprintf(xstats_names[count].name, > - sizeof(xstats_names[count].name), > - "%s", > - ipn3ke_rpst_hw_port_strings[i].name); > + strlcpy(xstats_names[count].name, > + ipn3ke_rpst_hw_port_strings[i].name, > + sizeof(xstats_names[count].name)); > count++; > } >=20 > -- > 2.39.2 Reviewed-by: Rosen Xu