rp/dma: fix use-after-free read.

This commit is contained in:
Dario Nieuwenhuis 2023-06-05 22:28:14 +02:00
parent d690a1717f
commit 5ee26a5dd1

View File

@ -75,16 +75,17 @@ pub unsafe fn write<'a, C: Channel, W: Word>(
) )
} }
static DUMMY: u32 = 0;
pub unsafe fn write_repeated<'a, C: Channel, W: Word>( pub unsafe fn write_repeated<'a, C: Channel, W: Word>(
ch: impl Peripheral<P = C> + 'a, ch: impl Peripheral<P = C> + 'a,
to: *mut W, to: *mut W,
len: usize, len: usize,
dreq: u8, dreq: u8,
) -> Transfer<'a, C> { ) -> Transfer<'a, C> {
let dummy: u32 = 0;
copy_inner( copy_inner(
ch, ch,
&dummy as *const u32, &DUMMY as *const u32,
to as *mut u32, to as *mut u32,
len, len,
W::size(), W::size(),