| 295 | } |
| 296 | |
| 297 | static void |
| 298 | eval_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 | |
| 325 | static void |
| 326 | eval_rsh(struct bpf_reg_val *rd, const struct bpf_reg_val *rs, size_t opsz, |
no test coverage detected