[v4,13/21] common/idpf: update in PTP message validation

Message ID 20240618105722.2326987-14-soumyadeep.hore@intel.com (mailing list archive)
State Superseded
Delegated to: Bruce Richardson
Headers
Series Update MEV TS Base Driver |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Soumyadeep Hore June 18, 2024, 10:57 a.m. UTC
  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 <soumyadeep.hore@intel.com>
---
 drivers/common/idpf/base/virtchnl2.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Patch

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;