(u8 *)&stats, sizeof(stats));
 }
 
+/**
+ * ice_vc_validate_vqs_bitmaps - validate Rx/Tx queue bitmaps from VIRTCHNL
+ * @vqs: virtchnl_queue_select structure containing bitmaps to validate
+ *
+ * Return true on successful validation, else false
+ */
+static bool ice_vc_validate_vqs_bitmaps(struct virtchnl_queue_select *vqs)
+{
+       if ((!vqs->rx_queues && !vqs->tx_queues) ||
+           vqs->rx_queues >= BIT(ICE_MAX_BASE_QS_PER_VF) ||
+           vqs->tx_queues >= BIT(ICE_MAX_BASE_QS_PER_VF))
+               return false;
+
+       return true;
+}
+
 /**
  * ice_vc_ena_qs_msg
  * @vf: pointer to the VF info
                goto error_param;
        }
 
-       if (!vqs->rx_queues && !vqs->tx_queues) {
-               v_ret = VIRTCHNL_STATUS_ERR_PARAM;
-               goto error_param;
-       }
-
-       if (vqs->rx_queues > ICE_MAX_BASE_QS_PER_VF ||
-           vqs->tx_queues > ICE_MAX_BASE_QS_PER_VF) {
+       if (!ice_vc_validate_vqs_bitmaps(vqs)) {
                v_ret = VIRTCHNL_STATUS_ERR_PARAM;
                goto error_param;
        }
                goto error_param;
        }
 
-       if (!vqs->rx_queues && !vqs->tx_queues) {
+       if (!ice_vc_validate_vqs_bitmaps(vqs)) {
                v_ret = VIRTCHNL_STATUS_ERR_PARAM;
                goto error_param;
        }