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 541CC440F2; Tue, 28 May 2024 10:10:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1968240A4B; Tue, 28 May 2024 10:10:39 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by mails.dpdk.org (Postfix) with ESMTP id 6696D406BC for ; Tue, 28 May 2024 10:10:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716883836; x=1748419836; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Onh/xb15TGbIrYWggWO5UI8Gmy2U9cr6KI2Ni9pzbas=; b=TdZYApbzDZpgGMHNQgGh02ygfXdAKBoEwucvgQC5g+K9SAYs32fuRB7C LAaLzuf8AUz/LN46A/FPOFqUDVTtctTtpLmkc5YHzkWUJQQ9+O9z9X363 rThRU+aXi4AbZnqbZ+WkWF0PFLPZbZoY5sobtYb1SyfUIDr4BHYN+IqWM VavoJATHHngwimct4NX3XIbsUK+2vScDKk7BUvXo9k74kftIz42k8XmE/ Phz7fPgAGzrjj0Ye4p1wNJ0W34lvCTGOI7+vAPCWIKE3T9xdteqj4kbC6 FuAyGcHLza97w2ANlmk8XFaotgqNj/qPB5cuLKueS8TI26+9Mlx+3gMix g==; X-CSE-ConnectionGUID: QzOngUPzT/KqKGXKWHUv6w== X-CSE-MsgGUID: GLfE5nDzQgahv9wSx06LWw== X-IronPort-AV: E=McAfee;i="6600,9927,11085"; a="16161923" X-IronPort-AV: E=Sophos;i="6.08,194,1712646000"; d="scan'208";a="16161923" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2024 01:10:35 -0700 X-CSE-ConnectionGUID: Sok4O6kvRIKW1gjAXrl+Mg== X-CSE-MsgGUID: v7JE1rYaQoif2knxjUOv7Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,194,1712646000"; d="scan'208";a="66197682" Received: from unknown (HELO npf-hyd-clx-03..) ([10.145.170.182]) by fmviesa001.fm.intel.com with ESMTP; 28 May 2024 01:10:34 -0700 From: Soumyadeep Hore To: yuying.zhang@intel.com, jingjing.wu@intel.com Cc: dev@dpdk.org Subject: [PATCH 04/25] common/idpf: update in PTP message validation Date: Tue, 28 May 2024 07:28:34 +0000 Message-ID: <20240528072839.867100-5-soumyadeep.hore@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240528072839.867100-1-soumyadeep.hore@intel.com> References: <20240528072839.867100-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 f44c0965b4..9a1310ca24 100644 --- a/drivers/common/idpf/base/virtchnl2.h +++ b/drivers/common/idpf/base/virtchnl2.h @@ -1873,7 +1873,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; @@ -1889,7 +1889,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