{"record":{"id":"23e7841d40dfdd19","repo":"embassy-rs/embassy","slug":"this-function-has-not-been-converted-to-volatile-s","errorCode":null,"errorMessage":"this function has not been converted to volatile semantics","messagePattern":"this function has not been converted to volatile semantics","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"embassy-stm32-wpan/src/wb/unsafe_linked_list.rs","lineNumber":210,"sourceCode":"        ref_node.next = p_node;\n        prev_node.prev = p_node;\n\n        ptr::write_volatile(p_node, node);\n        ptr::write_volatile(p_ref_node, ref_node);\n        ptr::write_volatile(node.next, prev_node);\n    }\n\n    pub unsafe fn insert_node_before(\n        _cs: CriticalSection,\n        mut node: *mut LinkedListNode,\n        mut ref_node: *mut LinkedListNode,\n    ) {\n        (*node).next = ref_node;\n        (*node).prev = (*ref_node).prev;\n        (*ref_node).prev = node;\n        (*(*node).prev).next = node;\n\n        todo!(\"this function has not been converted to volatile semantics\");\n    }\n\n    pub unsafe fn get_size(_cs: CriticalSection, mut list_head: *mut LinkedListNode) -> usize {\n        let mut size = 0;\n        let mut temp: *mut LinkedListNode = core::ptr::null_mut::<LinkedListNode>();\n\n        temp = (*list_head).next;\n        while temp != list_head {\n            size += 1;\n            temp = (*temp).next\n        }\n\n        let _ = size;\n\n        todo!(\"this function has not been converted to volatile semantics\");\n    }\n\n    pub unsafe fn get_next_node(_cs: CriticalSection, mut p_ref_node: *mut LinkedListNode) -> *mut LinkedListNode {","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-stm32-wpan/src/wb/unsafe_linked_list.rs#L192-L228","documentation":"`insert_node_before` in the WPAN unsafe linked list still performs raw pointer writes without volatile operations, which is required because the list is shared with the wireless coprocessor core. The function deliberately panics with `todo!` until it is ported to volatile semantics, so it must not be called.","triggerScenarios":"Calling `unsafe_linked_list::insert_node_before(...)` — any invocation panics after mutating the list pointers, leaving the list corrupted before the panic.","commonSituations":"Extending the embassy-stm32-wpan stack with custom list operations; calling internal WPAN list helpers directly instead of the higher-level BLE/MAC APIs; porting code from older versions of the wpan crate where the function existed.","solutions":["Do not call `insert_node_before`; use the higher-level embassy-stm32-wpan APIs (BLE/MAC stack entry points) that manage the list.","Use `remove_node`/`get_next_node`/`get_size`-style operations that have been converted to volatile access.","Implement the insertion yourself with `ptr::read_volatile`/`write_volatile` if you must manipulate the shared list.","Check embassy-stm32-wpan releases/changelog for when volatile semantics land for this function."],"exampleFix":"// before\nunsafe { unsafe_linked_list::insert_node_before(cs, node, ref_node) };\n// after (volatile-equivalent, or use supported APIs)\nunsafe {\n    (*node).next = ptr::read_volatile(ref_node);\n    (*node).prev = ptr::read_volatile((*ref_node).prev);\n    ptr::write_volatile(&mut (*ref_node).prev, node);\n    let prev = ptr::read_volatile((*node).prev);\n    ptr::write_volatile(&mut (*prev).next, node);\n}","handlingStrategy":"validation","validationCode":"// Avoid the panicking helper entirely; use only volatile-converted ops:\n// safe alternatives: remove_node, get_next_node\n// fn uses_supported_list_apis(code: &str) -> bool {\n//     !code.contains(\"insert_node_before\")\n// }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never call unsafe_linked_list::insert_node_before — it panics by design","Manipulate the shared WPAN list only with read_volatile/write_volatile helpers","Prefer the higher-level embassy-stm32-wpan BLE/MAC APIs over raw list access","Track upstream progress on volatile conversion before relying on this function"],"tags":["wpan","stm32","not-implemented","panic","linked-list"],"backgroundTag":"method-not-implemented","analyzedSha":"463a07b963419a1bfe61d5d597c44acb810afb8b","analyzedAt":"2026-09-10T13:38:26.660Z","contentChangedAt":"2026-09-10T13:38:26.660Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}