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 98C884414E; Tue, 4 Jun 2024 10:50:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AA5C94356F; Tue, 4 Jun 2024 10:49:07 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) by mails.dpdk.org (Postfix) with ESMTP id 2D43143599 for ; Tue, 4 Jun 2024 10:49:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717490944; x=1749026944; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AEzTaxOV89clCh23sb5+pW2FHrp4HwbFzy2N5sRKHGU=; b=V46Ke6eTFpsx6pNCnSQTSaKm1REiVYC92F/O1QX9NsCwkaRBwYVYE+rz EHJfxcgTiYhau3j8f9mPvmM4+g24I0SOcUnSbJAqfrdWYxSRHvJS8Cjj1 EXQ6YGcNvh5FMGH5CUEDQNofhCj19ldzDOv/Jt4PIdpv0NHv/uCpxhTjY t3pUoyxwrXV9OWEUg8LGECp1Q2eTryS8ge5sez+VJG/Wzv7NLuGwV+JYY IINmgCDaXZPdoSrbG/jAMojfwi0GirQze58x+dWCXY9zq4tOSVRLHGb9w bRepk3Kte8Tm6z5RpgxtANB3NgJmkFbol08jvIYFQyW99QzVT9ABhBMhs A==; X-CSE-ConnectionGUID: hozHSiGmQS6FlA7WyobJpg== X-CSE-MsgGUID: E/O5O+DiRQ+HvtQLu9ummg== X-IronPort-AV: E=McAfee;i="6600,9927,11092"; a="13971724" X-IronPort-AV: E=Sophos;i="6.08,213,1712646000"; d="scan'208";a="13971724" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2024 01:49:04 -0700 X-CSE-ConnectionGUID: Zq81vgPeS9ClgEfY/dxmYg== X-CSE-MsgGUID: XzQcBcsuToeuAYUZCqFJEA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,213,1712646000"; d="scan'208";a="42268702" Received: from unknown (HELO npf-hyd-clx-03..) ([10.145.170.182]) by orviesa004.jf.intel.com with ESMTP; 04 Jun 2024 01:49:02 -0700 From: Soumyadeep Hore To: bruce.richardson@intel.com, anatoly.burakov@intel.com Cc: dev@dpdk.org Subject: [PATCH v2 14/21] common/idpf: update in PTP message validation Date: Tue, 4 Jun 2024 08:06:04 +0000 Message-ID: <20240604080611.2197835-15-soumyadeep.hore@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240604080611.2197835-1-soumyadeep.hore@intel.com> References: <20240528072839.867100-1-soumyadeep.hore@intel.com> <20240604080611.2197835-1-soumyadeep.hore@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 When the message for getting timestamp latches is sent by the driver, number of latches is equal to 0. Current implementation of message validation function incorrectly notifies this kind of message length as invalid. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/base/virtchnl2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/common/idpf/base/virtchnl2.h b/drivers/common/idpf/base/virtchnl2.h index 35ff1942c2..b5703cb6ed 100644 --- a/drivers/common/idpf/base/virtchnl2.h +++ b/drivers/common/idpf/base/virtchnl2.h @@ -2270,7 +2270,7 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3 case VIRTCHNL2_OP_GET_PTP_CAPS: valid_len = sizeof(struct virtchnl2_get_ptp_caps); - if (msglen >= valid_len) { + if (msglen > valid_len) { struct virtchnl2_get_ptp_caps *ptp_caps = (struct virtchnl2_get_ptp_caps *)msg; @@ -2286,7 +2286,7 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3 case VIRTCHNL2_OP_GET_PTP_TX_TSTAMP_LATCHES: valid_len = sizeof(struct virtchnl2_ptp_tx_tstamp_latches); - if (msglen >= valid_len) { + if (msglen > valid_len) { struct virtchnl2_ptp_tx_tstamp_latches *tx_tstamp_latches = (struct virtchnl2_ptp_tx_tstamp_latches *)msg; -- 2.43.0