diff --git a/aya/src/obj/mod.rs b/aya/src/obj/mod.rs index 5c714bb4..2579dca7 100644 --- a/aya/src/obj/mod.rs +++ b/aya/src/obj/mod.rs @@ -521,7 +521,9 @@ fn parse_map_def(name: &str, data: &[u8]) -> Result { unsafe { // std::ptr::copy is const, we can't use it because data.len() isn't known at - // compile time + // compile time, this is only safe because we've asserted that data.len() + // must be <= mem::size_of::(), if you change that check, then + // you must change this copy let mut p = data.as_ptr(); let mut q = &mut map_def as *mut bpf_map_def as *mut u8; for _ in 0..=data.len() {