On 9/25/25 4:10 PM, Michael S. Tsirkin wrote:
> On Tue, Sep 23, 2025 at 09:19:15AM -0500, Daniel Jurgens wrote:
>> Filtering a flow requires a classifier to match the packets, and a rule
>> to filter on the matches.

>> +    ff_rule->group_id = cpu_to_le32(VIRTNET_FF_ETHTOOL_GROUP_PRIORITY);
>> +    ff_rule->classifier_id = cpu_to_le32(classifier_id);
>> +    ff_rule->key_length = (u8)key_size;
> 
> Do we know that key size is <256?

We set key size based on sizeof headers even if all 5 available were in
the key it would still be less than 256.

> 
> 
>> +err_ff_rule:
>> +    kfree(ff_rule);
>> +err_eth_rule:
>> +    xa_erase(&ff->ethtool.rules, eth_rule->flow_spec.location);
>> +    kfree(eth_rule);
> 
> This is a weird way to handle errors. You never added or allocated eth_rule,
> which are you erasing and freeing here?
> 
> 

Yes, it was left behind during some refactoring. Thanks.


>> +    c = kzalloc(classifier_size +
>> +                sizeof(struct virtnet_classifier) -
>> +                sizeof(struct virtio_net_resource_obj_ff_classifier),
> 
> do we know all this math does not overflow?
> 

Yes, classifier size is based on size_ofs



Reply via email to