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

Function eval_and

dpdk/lib/bpf/bpf_validate.c:409–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407}
408
409static void
410eval_and(struct bpf_reg_val *rd, const struct bpf_reg_val *rs, size_t opsz,
411 uint64_t msk)
412{
413 /* both operands are constants */
414 if (rd->u.min == rd->u.max && rs->u.min == rs->u.max) {
415 rd->u.min &= rs->u.min;
416 rd->u.max &= rs->u.max;
417 } else {
418 rd->u.max = eval_uand_max(rd->u.max, rs->u.max, opsz);
419 rd->u.min &= rs->u.min;
420 }
421
422 /* both operands are constants */
423 if (rd->s.min == rd->s.max && rs->s.min == rs->s.max) {
424 rd->s.min &= rs->s.min;
425 rd->s.max &= rs->s.max;
426 /* at least one of operand is non-negative */
427 } else if (rd->s.min >= 0 || rs->s.min >= 0) {
428 rd->s.max = eval_uand_max(rd->s.max & (msk >> 1),
429 rs->s.max & (msk >> 1), opsz);
430 rd->s.min &= rs->s.min;
431 } else
432 eval_smax_bound(rd, msk);
433}
434
435static void
436eval_or(struct bpf_reg_val *rd, const struct bpf_reg_val *rs, size_t opsz,

Callers 1

eval_aluFunction · 0.85

Calls 2

eval_uand_maxFunction · 0.85
eval_smax_boundFunction · 0.85

Tested by

no test coverage detected