Merge ra.kernel.org:/pub/scm/linux/kernel/git/netdev/net
This commit is contained in:
@@ -44,14 +44,19 @@ struct tnum tnum_rshift(struct tnum a, u8 shift)
|
||||
return TNUM(a.value >> shift, a.mask >> shift);
|
||||
}
|
||||
|
||||
struct tnum tnum_arshift(struct tnum a, u8 min_shift)
|
||||
struct tnum tnum_arshift(struct tnum a, u8 min_shift, u8 insn_bitness)
|
||||
{
|
||||
/* if a.value is negative, arithmetic shifting by minimum shift
|
||||
* will have larger negative offset compared to more shifting.
|
||||
* If a.value is nonnegative, arithmetic shifting by minimum shift
|
||||
* will have larger positive offset compare to more shifting.
|
||||
*/
|
||||
return TNUM((s64)a.value >> min_shift, (s64)a.mask >> min_shift);
|
||||
if (insn_bitness == 32)
|
||||
return TNUM((u32)(((s32)a.value) >> min_shift),
|
||||
(u32)(((s32)a.mask) >> min_shift));
|
||||
else
|
||||
return TNUM((s64)a.value >> min_shift,
|
||||
(s64)a.mask >> min_shift);
|
||||
}
|
||||
|
||||
struct tnum tnum_add(struct tnum a, struct tnum b)
|
||||
|
@@ -5049,9 +5049,16 @@ static int adjust_scalar_min_max_vals(struct bpf_verifier_env *env,
|
||||
/* Upon reaching here, src_known is true and
|
||||
* umax_val is equal to umin_val.
|
||||
*/
|
||||
dst_reg->smin_value >>= umin_val;
|
||||
dst_reg->smax_value >>= umin_val;
|
||||
dst_reg->var_off = tnum_arshift(dst_reg->var_off, umin_val);
|
||||
if (insn_bitness == 32) {
|
||||
dst_reg->smin_value = (u32)(((s32)dst_reg->smin_value) >> umin_val);
|
||||
dst_reg->smax_value = (u32)(((s32)dst_reg->smax_value) >> umin_val);
|
||||
} else {
|
||||
dst_reg->smin_value >>= umin_val;
|
||||
dst_reg->smax_value >>= umin_val;
|
||||
}
|
||||
|
||||
dst_reg->var_off = tnum_arshift(dst_reg->var_off, umin_val,
|
||||
insn_bitness);
|
||||
|
||||
/* blow away the dst_reg umin_value/umax_value and rely on
|
||||
* dst_reg var_off to refine the result.
|
||||
|
Reference in New Issue
Block a user