aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-06-05 22:28:14 +0200
committerDario Nieuwenhuis <[email protected]>2023-06-05 22:28:14 +0200
commit5ee26a5dd1af3e172610b94b2657af709b319dad (patch)
treee325c28fd771bbfe1ff657f4a636e3e234c05ad1
parentd690a1717fd03a1f3fdad509d6a638567f8a645a (diff)
rp/dma: fix use-after-free read.
-rw-r--r--embassy-rp/src/dma.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/embassy-rp/src/dma.rs b/embassy-rp/src/dma.rs
index 74f4e6998..1cbb4651a 100644
--- a/embassy-rp/src/dma.rs
+++ b/embassy-rp/src/dma.rs
@@ -75,16 +75,17 @@ pub unsafe fn write<'a, C: Channel, W: Word>(
75 ) 75 )
76} 76}
77 77
78static DUMMY: u32 = 0;
79
78pub unsafe fn write_repeated<'a, C: Channel, W: Word>( 80pub unsafe fn write_repeated<'a, C: Channel, W: Word>(
79 ch: impl Peripheral<P = C> + 'a, 81 ch: impl Peripheral<P = C> + 'a,
80 to: *mut W, 82 to: *mut W,
81 len: usize, 83 len: usize,
82 dreq: u8, 84 dreq: u8,
83) -> Transfer<'a, C> { 85) -> Transfer<'a, C> {
84 let dummy: u32 = 0;
85 copy_inner( 86 copy_inner(
86 ch, 87 ch,
87 &dummy as *const u32, 88 &DUMMY as *const u32,
88 to as *mut u32, 89 to as *mut u32,
89 len, 90 len,
90 W::size(), 91 W::size(),