Skip to content

Commit db5e8ea

Browse files
jglazaanguy11
authored andcommitted
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: 1f7ea1c ("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>
1 parent 7fd71f3 commit db5e8ea

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

include/linux/avf/virtchnl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,7 @@ struct virtchnl_proto_hdrs {
12831283
* 2 - from the second inner layer
12841284
* ....
12851285
**/
1286-
int count; /* the proto layers must < VIRTCHNL_MAX_NUM_PROTO_HDRS */
1286+
u32 count; /* the proto layers must < VIRTCHNL_MAX_NUM_PROTO_HDRS */
12871287
union {
12881288
struct virtchnl_proto_hdr
12891289
proto_hdr[VIRTCHNL_MAX_NUM_PROTO_HDRS];
@@ -1335,7 +1335,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(36, virtchnl_filter_action);
13351335

13361336
struct virtchnl_filter_action_set {
13371337
/* action number must be less then VIRTCHNL_MAX_NUM_ACTIONS */
1338-
int count;
1338+
u32 count;
13391339
struct virtchnl_filter_action actions[VIRTCHNL_MAX_NUM_ACTIONS];
13401340
};
13411341

0 commit comments

Comments
 (0)