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 07668424D8; Wed, 12 Jun 2024 06:38:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 69D1B40E4F; Wed, 12 Jun 2024 06:37:09 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by mails.dpdk.org (Postfix) with ESMTP id A66C440E4B for ; Wed, 12 Jun 2024 06:37:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718167028; x=1749703028; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nZU8o2JCNaC9u+4hBIwhDFA1aXbgKdVbR4QJepfQavI=; b=VotgzMKg615VoPn7KTEL8wFEYuRSnRkD/ABdygIWxd73wTSWxDWlzQip LJdd2INxWyUAelivY2ixGW0Xm57RQ8IjLD7XGDAT6AQdkdZCnQsWVsth4 KHq7GyJZ1ax8JWllwjL8lYaPuZJSpuOiQGZejN3sWqlPyTBUpZRfOu3Ej JuVkSJm3FbrDB0454l3jQ6gD4dk0g92pd/X3F7/Mr1MwsSfF1ZEsYMl14 JsxS+1UYqksMRm37vZ7hV2BBLKmiFL04x1uJHb/OiQ1jEJQkSFQ+d2vsv vARU6eGFEJjVebAWIyqFrQ3t6M3S+pNP9cswD+6iQ9mvvyAcfj1SaXdFH w==; X-CSE-ConnectionGUID: BID5ijObSa+pVJcUflYNZw== X-CSE-MsgGUID: 8uqs9JFIScuOAKHaMfUNcQ== X-IronPort-AV: E=McAfee;i="6600,9927,11100"; a="18742205" X-IronPort-AV: E=Sophos;i="6.08,232,1712646000"; d="scan'208";a="18742205" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2024 21:37:08 -0700 X-CSE-ConnectionGUID: mOWX782lSjurlpyJv1E/bQ== X-CSE-MsgGUID: E5L6JagRQZKmcVgHB2GaZA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,232,1712646000"; d="scan'208";a="40281969" Received: from unknown (HELO npf-hyd-clx-03..) ([10.145.170.182]) by orviesa008.jf.intel.com with ESMTP; 11 Jun 2024 21:37:06 -0700 From: Soumyadeep Hore To: bruce.richardson@intel.com, anatoly.burakov@intel.com Cc: dev@dpdk.org Subject: [PATCH v3 14/22] common/idpf: update in PTP message validation Date: Wed, 12 Jun 2024 03:52:49 +0000 Message-ID: <20240612035257.2245824-15-soumyadeep.hore@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240612035257.2245824-1-soumyadeep.hore@intel.com> References: <20240604080611.2197835-1-soumyadeep.hore@intel.com> <20240612035257.2245824-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 e76ccbd46f..24a8b37876 100644 --- a/drivers/common/idpf/base/virtchnl2.h +++ b/drivers/common/idpf/base/virtchnl2.h @@ -2272,7 +2272,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; @@ -2288,7 +2288,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