MCPcopy Create free account
hub / github.com/F-Stack/f-stack / eval_lsh

Function eval_lsh

dpdk/lib/bpf/bpf_validate.c:297–323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295}
296
297static void
298eval_lsh(struct bpf_reg_val *rd, const struct bpf_reg_val *rs, size_t opsz,
299 uint64_t msk)
300{
301 /* check if shift value is less then max result bits */
302 if (rs->u.max >= opsz) {
303 eval_max_bound(rd, msk);
304 return;
305 }
306
307 /* check for overflow */
308 if (rd->u.max > RTE_LEN2MASK(opsz - rs->u.max, uint64_t))
309 eval_umax_bound(rd, msk);
310 else {
311 rd->u.max <<= rs->u.max;
312 rd->u.min <<= rs->u.min;
313 }
314
315 /* check that dreg values are and would remain always positive */
316 if ((uint64_t)rd->s.min >> (opsz - 1) != 0 || rd->s.max >=
317 RTE_LEN2MASK(opsz - rs->u.max - 1, int64_t))
318 eval_smax_bound(rd, msk);
319 else {
320 rd->s.max <<= rs->u.max;
321 rd->s.min <<= rs->u.min;
322 }
323}
324
325static void
326eval_rsh(struct bpf_reg_val *rd, const struct bpf_reg_val *rs, size_t opsz,

Callers 1

eval_aluFunction · 0.85

Calls 3

eval_max_boundFunction · 0.85
eval_umax_boundFunction · 0.85
eval_smax_boundFunction · 0.85

Tested by

no test coverage detected