mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-13 17:39:23 -04:00
virtchnl: make proto and filter action count unsigned
The count field in virtchnl_proto_hdrs and virtchnl_filter_action_set
should never be negative while still being valid. Changing it from
int to u32 ensures proper handling of values in virtchnl messages in
driverrs and prevents unintended behavior.
In its current signed form, a negative count does not trigger
an error in ice driver but instead results in it being treated as 0.
This can lead to unexpected outcomes when processing messages.
By using u32, any invalid values will correctly trigger -EINVAL,
making error detection more robust.
Fixes: 1f7ea1cd6a ("ice: Enable FDIR Configure for AVF")
Reviewed-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Jan Glaza <jan.glaza@intel.com>
Signed-off-by: Martyna Szapar-Mudlaw <martyna.szapar-mudlaw@linux.intel.com>
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
This commit is contained in:
@@ -1283,7 +1283,7 @@ struct virtchnl_proto_hdrs {
|
||||
* 2 - from the second inner layer
|
||||
* ....
|
||||
**/
|
||||
int count; /* the proto layers must < VIRTCHNL_MAX_NUM_PROTO_HDRS */
|
||||
u32 count; /* the proto layers must < VIRTCHNL_MAX_NUM_PROTO_HDRS */
|
||||
union {
|
||||
struct virtchnl_proto_hdr
|
||||
proto_hdr[VIRTCHNL_MAX_NUM_PROTO_HDRS];
|
||||
@@ -1335,7 +1335,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(36, virtchnl_filter_action);
|
||||
|
||||
struct virtchnl_filter_action_set {
|
||||
/* action number must be less then VIRTCHNL_MAX_NUM_ACTIONS */
|
||||
int count;
|
||||
u32 count;
|
||||
struct virtchnl_filter_action actions[VIRTCHNL_MAX_NUM_ACTIONS];
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user