[PATCH v3 14/22] common/idpf: update in PTP message validation

Soumyadeep Hore soumyadeep.hore at intel.com
Wed Jun 12 05:52:49 CEST 2024


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 at intel.com>
---
 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



More information about the dev mailing list