Lines Matching refs:prog
30 fn check_prog_len(prog: &[u8]) -> Result<(), Error> { in check_prog_len()
31 if prog.len() % ebpf::INSN_SIZE != 0 { in check_prog_len()
37 if prog.len() > ebpf::PROG_MAX_SIZE { in check_prog_len()
41 prog.len() / ebpf::INSN_SIZE in check_prog_len()
45 if prog.is_empty() { in check_prog_len()
48 let last_opc = ebpf::get_insn(prog, (prog.len() / ebpf::INSN_SIZE) - 1).opc; in check_prog_len()
65 fn check_load_dw(prog: &[u8], insn_ptr: usize) -> Result<(), Error> { in check_load_dw()
68 let next_insn = ebpf::get_insn(prog, insn_ptr + 1); in check_load_dw()
76 fn check_jmp_offset(prog: &[u8], insn_ptr: usize) -> Result<(), Error> { in check_jmp_offset()
77 let insn = ebpf::get_insn(prog, insn_ptr); in check_jmp_offset()
83 if dst_insn_ptr < 0 || dst_insn_ptr as usize >= (prog.len() / ebpf::INSN_SIZE) { in check_jmp_offset()
89 let dst_insn = ebpf::get_insn(prog, dst_insn_ptr as usize); in check_jmp_offset()
113 pub fn check(prog: &[u8]) -> Result<(), Error> { in check()
114 check_prog_len(prog)?; in check()
117 while insn_ptr * ebpf::INSN_SIZE < prog.len() { in check()
118 let insn = ebpf::get_insn(prog, insn_ptr); in check()
134 check_load_dw(prog, insn_ptr)?; in check()
224 check_jmp_offset(prog, insn_ptr)?; in check()
227 check_jmp_offset(prog, insn_ptr)?; in check()
230 check_jmp_offset(prog, insn_ptr)?; in check()
233 check_jmp_offset(prog, insn_ptr)?; in check()
236 check_jmp_offset(prog, insn_ptr)?; in check()
239 check_jmp_offset(prog, insn_ptr)?; in check()
242 check_jmp_offset(prog, insn_ptr)?; in check()
245 check_jmp_offset(prog, insn_ptr)?; in check()
248 check_jmp_offset(prog, insn_ptr)?; in check()
251 check_jmp_offset(prog, insn_ptr)?; in check()
254 check_jmp_offset(prog, insn_ptr)?; in check()
257 check_jmp_offset(prog, insn_ptr)?; in check()
260 check_jmp_offset(prog, insn_ptr)?; in check()
263 check_jmp_offset(prog, insn_ptr)?; in check()
266 check_jmp_offset(prog, insn_ptr)?; in check()
269 check_jmp_offset(prog, insn_ptr)?; in check()
272 check_jmp_offset(prog, insn_ptr)?; in check()
275 check_jmp_offset(prog, insn_ptr)?; in check()
278 check_jmp_offset(prog, insn_ptr)?; in check()
281 check_jmp_offset(prog, insn_ptr)?; in check()
284 check_jmp_offset(prog, insn_ptr)?; in check()
287 check_jmp_offset(prog, insn_ptr)?; in check()
290 check_jmp_offset(prog, insn_ptr)?; in check()
295 check_jmp_offset(prog, insn_ptr)?; in check()
298 check_jmp_offset(prog, insn_ptr)?; in check()
301 check_jmp_offset(prog, insn_ptr)?; in check()
304 check_jmp_offset(prog, insn_ptr)?; in check()
307 check_jmp_offset(prog, insn_ptr)?; in check()
310 check_jmp_offset(prog, insn_ptr)?; in check()
313 check_jmp_offset(prog, insn_ptr)?; in check()
316 check_jmp_offset(prog, insn_ptr)?; in check()
319 check_jmp_offset(prog, insn_ptr)?; in check()
322 check_jmp_offset(prog, insn_ptr)?; in check()
325 check_jmp_offset(prog, insn_ptr)?; in check()
328 check_jmp_offset(prog, insn_ptr)?; in check()
331 check_jmp_offset(prog, insn_ptr)?; in check()
334 check_jmp_offset(prog, insn_ptr)?; in check()
337 check_jmp_offset(prog, insn_ptr)?; in check()
340 check_jmp_offset(prog, insn_ptr)?; in check()
343 check_jmp_offset(prog, insn_ptr)?; in check()
346 check_jmp_offset(prog, insn_ptr)?; in check()
349 check_jmp_offset(prog, insn_ptr)?; in check()
352 check_jmp_offset(prog, insn_ptr)?; in check()
355 check_jmp_offset(prog, insn_ptr)?; in check()
358 check_jmp_offset(prog, insn_ptr)?; in check()
381 if insn_ptr != prog.len() / ebpf::INSN_SIZE { in check()