i40e: add input validation for virtchnl handlers
authorSergey Nemov <sergey.nemov@intel.com>
Wed, 24 Apr 2019 12:20:51 +0000 (05:20 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 14 Jun 2019 19:59:16 +0000 (12:59 -0700)
commitd510497b8397ec875edd1a86aaee207822245eee
tree82b6f142cd060a85f306d126692938aaaf4e28c0
parentb83ebf506ba3241ccb61175f432f7ae4fece9111
i40e: add input validation for virtchnl handlers

Change some data to unsigned int instead of integer when we compare.

Check LUT values in VIRTCHNL_OP_CONFIG_RSS_LUT handler.

Also enhance error/warning messages to print the real values of
I40E_MAX_VF_QUEUES, I40E_MAX_VF_VSI and I40E_DEFAULT_QUEUES_PER_VF
instead of plain text.

Refactor code to comply with 'check first then assign' policy.

Remove duplicate checks for VIRTCHNL_OP_CONFIG_RSS_KEY and
VIRTCHNL_OP_CONFIG_RSS_LUT opcodes in i40e_vc_process_vf_msg(). We have
the very same checks inside the handlers already.

Signed-off-by: Sergey Nemov <sergey.nemov@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c