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 EE64C4567F; Mon, 22 Jul 2024 13:25:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BBD8840041; Mon, 22 Jul 2024 13:25:22 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) by mails.dpdk.org (Postfix) with ESMTP id 852F84003C for ; Mon, 22 Jul 2024 13:25:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721647521; x=1753183521; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=64RcVzjZVuzhC4tf4S+aC06ajIMCXhgG/O+AeDlGFxE=; b=cflB5g3fVzTnEiPaKwWpEiMFEoTawg7ejAk3V4jqynRfpXzPxU3lQ3Ea xapauhe8RAl5Qha2P1cRBJconrGfCTn63zCnnZ4wkl335ys57Jqm12u11 zPHEdAznFBu9AGW0SjA4oVGtff2zoyHg/AdNLWZY7kgS3Nf08JU0/my+i M3gPLY341KsCvEAZmeaUCOPt+gHQWweijRqz3OtA3Ar9sB+Au5p0aZ5Gk hUYfFNrUPmdFPrrLl66f93bxAN5B2+Gknm2NCH50OEqUoVMJMAJc6d0NJ CWtpXajmE5OL4XatqMsIo7MbKf2w/pkEKmIqxi2Lqx4GrjLuzgZFfHwRV A==; X-CSE-ConnectionGUID: lZCplepsSDqgN2sRKscDqA== X-CSE-MsgGUID: FRccnUvpSxC8SjvbM0e1qA== X-IronPort-AV: E=McAfee;i="6700,10204,11140"; a="30596470" X-IronPort-AV: E=Sophos;i="6.09,228,1716274800"; d="scan'208";a="30596470" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2024 04:25:20 -0700 X-CSE-ConnectionGUID: uE9pZa5lQiO1CFyOG7T0Hg== X-CSE-MsgGUID: HmTcvswCRYKI0BRpVy6Erw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,228,1716274800"; d="scan'208";a="52469193" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orviesa007.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 22 Jul 2024 04:25:19 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 22 Jul 2024 04:25:19 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 22 Jul 2024 04:25:18 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Mon, 22 Jul 2024 04:25:18 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.169) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 22 Jul 2024 04:25:18 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QVf2SdRD05vBSSxvweAMCVUYGgIJxO+tuvhsgjKch3/jLt0yZmGtWOo9PnYqWkLh4rhHVWsrsDHbFZ+YdFrSE1Xl6iU9WD+YXG4lRI336awWS5bgeYbLSJv1b75rKbVC+0/S3kGrB6jB7gzwD6lunqum7SQZacCuHkF+nHgH6VO++Qxqu9TnbHIq4C25JIWebdnLfdLfZbU4l+zsbBaBpjpqeO+CfclUjy9CGjB3LkFJ0h95rkFPfgaCG2eLmJFlRlMOXQ82cJY/P7VpCI5/f1MsnVVOynKbzCaMSy93p+YTjTRyLTICcwSW8lOQhpIXo19NmMSi8Q0cdwMqxQkLlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=GJKuFPnzs/sGH+iTm8pF8XELKYH15rtQ1KmW2QcPhMM=; b=NFO5KGSOm8XhF9raUNYf0Ke2Y0ApfXkkvw3O/5i5kYKAZo/udQ/M7hMW7pByi5uYfrfxUzOdWb32jv/MhyM7zS3Q0JpN/kZOJJ4YqHEcbBuXX3FMh4G5Y50SdM9QY1QR70V+AA2DzNSA4ZxHSNx05b0WvF0tuF7QhKXRdMWr9EwPP0T+49FCwNOkamCLNmcjn6HhDKExuZHTwg0F18otW3+xpzMODWYQeY8hquiALShc4CnmhwFSIN9+9VnMyVIwwmc9RtGtd0A4Qcw0Zk7+yh8yb6eCTJ1RduBYS6iRMFqhAVqtBkKZmESgY7aAyHxjU0yn1sF3epvVdZxchV7DZg== 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 Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by CO1PR11MB5042.namprd11.prod.outlook.com (2603:10b6:303:99::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.14; Mon, 22 Jul 2024 11:25:16 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::f120:cc1f:d78d:ae9b]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::f120:cc1f:d78d:ae9b%7]) with mapi id 15.20.7784.016; Mon, 22 Jul 2024 11:25:16 +0000 Date: Mon, 22 Jul 2024 12:25:10 +0100 From: Bruce Richardson To: Vladimir Medvedkin CC: Subject: Re: [PATCH v4 2/3] net/ice: refactor raw pattern parsing function Message-ID: References: <20240722082836.176515-1-vladimir.medvedkin@intel.com> <20240722105950.199804-1-vladimir.medvedkin@intel.com> <20240722105950.199804-2-vladimir.medvedkin@intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20240722105950.199804-2-vladimir.medvedkin@intel.com> X-ClientProxiedBy: DBBPR09CA0024.eurprd09.prod.outlook.com (2603:10a6:10:c0::36) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|CO1PR11MB5042:EE_ X-MS-Office365-Filtering-Correlation-Id: 85980f2f-faa3-4f7a-c089-08dcaa40f61f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?N7IrYeRsniPMPb2/w8Lm7MNdgKdTKkPN59mfQMEIHgD6VyPd56cJXI7cH5nm?= =?us-ascii?Q?q86wtRWkU9BLAI2JyyPK8AWZYIGyVFXrQg0LJlU2NE9OQCqx5QrcYMwGXe6B?= =?us-ascii?Q?kTfk63E1uKYOgsf9Unrrz8k9obTqBAY9gcivUCO1UF1tUT4wSUVbDPKAN2Kg?= =?us-ascii?Q?VoqG6Yg1AvkA2UON9smuGWc4pOMUliQLuYPUHhbGZVG2PjkdkmhpvpUNbYC+?= =?us-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FMmeNqHgfdbLXSF?= =?us-ascii?Q?TN+FnqymQ0wUBMvPcTVuoNuF/2I54oKC3QfUWt2sMVZvom6MTdm5Q7ktrvU8?= =?us-ascii?Q?+P0bXXA1qD43Pcw1sh0Qoz09r3YvuxxMMvtWZ8xQS5cUm861J/RFcuII9CLY?= =?us-ascii?Q?SGwf8UzB+NgyOGTDYnzqwNSs/wxPvcCOVP5vf2jF6c1A+ZxSntPrtYqJrxN0?= =?us-ascii?Q?LaxL/n8j/S+H3Nu1/DkMYDzVpUgerD4Am7JQaOf3BUbR+Q=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?7zw0ozpBlZMsDw+q7rIkuBjZTS2SwvvYUzcDJ2x8tqk9D2/PisCniI0/bjqE?= =?us-ascii?Q?c0DFj9vkg23Js6uDeWCyGTEASvYfTncm42VG6Qnyz3KncnsWDnr69Thl5PLZ?= =?us-ascii?Q?bcVyK9Izt7Ps3rtmpQBQ19mSW2weP6JMoQXk8JQUKuB3gl//y53VkaExrr4f?= =?us-ascii?Q?nQETjUZz79Jd6nD5n83DY6JWfTXRavLmURrKQnOOHAz1ZPMTTj+2JWF4RRRG?= =?us-ascii?Q?o60uj2hntHxFxDBYdOLTFITOCjVQc4qMgFhBQAo5+MaQQkFj5l3Sd0fZkA+R?= =?us-ascii?Q?779aomqh7lNJXakxUQ8UUDrjBJCHRhWtgjcOiVFrM/68X57BNHEWekbgWyXK?= =?us-ascii?Q?QmMV/LUVSbw2X7xKohgdymu3Q/xQblJ4MB/RAQk6KvOLHHQzIh6u4lhgzKDE?= =?us-ascii?Q?KJQIxdPlBsHTywS/psXU1JQy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R?= =?us-ascii?Q?S3nxNpZb4g+5MAowugPq2s5B9W81m5fX5oZIHX60FqN6eCRK9enl8Cjk0b3q?= =?us-ascii?Q?pdgWiw06P40wRx/45tJAi4a5W45U1RtFMKt5krFJ9A9h7CBfYvnM9kU/o5c0?= =?us-ascii?Q?mtJstiZRX1zzYMw/fFZPNX1L81lYT1TjbvVmM8nG/qiUTcv7ypy30tTn51dY?= =?us-ascii?Q?nhY7/N1PJUgiEFKmaMlG+Wyu4o+ENjVSbxdIksts79q7QnR3tyIGhCTruCgm?= =?us-ascii?Q?cOLLyYUg8+gLPLFfE2BuXlY9/gkSMpMhlUGMAsSsNC1hsibEVdAP0zSRye5e?= =?us-ascii?Q?iw=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 85980f2f-faa3-4f7a-c089-08dcaa40f61f X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:25:16.5650 (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: oFISxHvz2ypnCS2MpbKS19kArRE0KoPaw8WGcMi+2aMDNaayRwyNHOhCn0SJHNxUtqYLOs5e5DL2M9ffI/0K5/BGMcr7dka9X6ubYUeotiw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR11MB5042 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 On Mon, Jul 22, 2024 at 10:59:49AM +0000, Vladimir Medvedkin wrote: > Replace strlen with more secure strnlen in ice_hash_parse_raw_pattern. > > Signed-off-by: Vladimir Medvedkin > --- > drivers/net/ice/ice_hash.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c > index 6b3095e2c5..506ea261e8 100644 > --- a/drivers/net/ice/ice_hash.c > +++ b/drivers/net/ice/ice_hash.c > @@ -658,9 +658,9 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad, > raw_spec = item->spec; > raw_mask = item->mask; > > - spec_len = strlen((char *)(uintptr_t)raw_spec->pattern); > - if (strlen((char *)(uintptr_t)raw_mask->pattern) != > - spec_len) > + spec_len = strnlen((char *)(uintptr_t)raw_spec->pattern, raw_spec->length); > + if (strnlen((char *)(uintptr_t)raw_mask->pattern, raw_spec->length) != > + spec_len) Are we missing something by not checking the return values from the length calls for overflow? If spec_len == raw_spec->length, then we have an overflow, and if raw_mask similarly overflows the comparison would still pass and not flag an error. /Bruce > return -rte_errno; > > pkt_len = spec_len / 2; > -- > 2.34.1 >