File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -2745,12 +2745,6 @@ static int kern_spec_to_ib_spec_action(struct uverbs_attr_bundle *attrs,
2745
2745
return 0 ;
2746
2746
}
2747
2747
2748
- static size_t kern_spec_filter_sz (const struct ib_uverbs_flow_spec_hdr * spec )
2749
- {
2750
- /* Returns user space filter size, includes padding */
2751
- return (spec -> size - sizeof (struct ib_uverbs_flow_spec_hdr )) / 2 ;
2752
- }
2753
-
2754
2748
static ssize_t spec_filter_size (const void * kern_spec_filter , u16 kern_filter_size ,
2755
2749
u16 ib_real_filter_sz )
2756
2750
{
@@ -2894,11 +2888,16 @@ int ib_uverbs_kern_spec_to_ib_spec_filter(enum ib_flow_spec_type type,
2894
2888
static int kern_spec_to_ib_spec_filter (struct ib_uverbs_flow_spec * kern_spec ,
2895
2889
union ib_flow_spec * ib_spec )
2896
2890
{
2897
- ssize_t kern_filter_sz ;
2891
+ size_t kern_filter_sz ;
2898
2892
void * kern_spec_mask ;
2899
2893
void * kern_spec_val ;
2900
2894
2901
- kern_filter_sz = kern_spec_filter_sz (& kern_spec -> hdr );
2895
+ if (check_sub_overflow ((size_t )kern_spec -> hdr .size ,
2896
+ sizeof (struct ib_uverbs_flow_spec_hdr ),
2897
+ & kern_filter_sz ))
2898
+ return - EINVAL ;
2899
+
2900
+ kern_filter_sz /= 2 ;
2902
2901
2903
2902
kern_spec_val = (void * )kern_spec +
2904
2903
sizeof (struct ib_uverbs_flow_spec_hdr );
You can’t perform that action at this time.
0 commit comments