File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,9 @@ fn main() -> ! {
71
71
// Save a copy on the stack so we can check it later
72
72
let source_buffer_cloned = * source_buffer;
73
73
74
+ // NOTE(unsafe): TARGET_BUFFER must also be initialised to prevent undefined
75
+ // behaviour (taking a mutable reference to uninitialised memory)
76
+
74
77
// Setup DMA
75
78
//
76
79
// We need to specify the transfer size with a type annotation
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ fn main() -> ! {
61
61
info ! ( "" ) ;
62
62
63
63
// Initialise the source buffer without taking any references to
64
- // uninitialisated memory
64
+ // uninitialised memory
65
65
let _source_buffer: & ' static mut [ u32 ; 200 ] = {
66
66
let buf: & mut [ MaybeUninit < u32 > ; 200 ] = unsafe {
67
67
& mut * ( core:: ptr:: addr_of_mut!( SOURCE_BUFFER )
@@ -76,6 +76,9 @@ fn main() -> ! {
76
76
unsafe { SOURCE_BUFFER . assume_init_mut ( ) }
77
77
} ;
78
78
79
+ // NOTE(unsafe): TARGET_BUFFER must also be initialised to prevent undefined
80
+ // behaviour (taking a mutable reference to uninitialised memory)
81
+
79
82
// Setup DMA
80
83
let streams = StreamsTuple :: new ( dp. MDMA , ccdr. peripheral . MDMA ) ;
81
84
You can’t perform that action at this time.
0 commit comments