aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2017-04-13 22:57:06 -0500
committerJorge Aparicio <japaricious@gmail.com>2017-04-13 22:58:29 -0500
commit2fb00c7d85f2eee6caa0bc742afd496a6ef7f33c (patch)
tree3f43c203a1cd2b9d0c53c984f8250bdfa8b42ffc /src
parent692ad81ad87299a14ed76dc455ceed011b9c5c45 (diff)
fix memory safety hole around `borrow`
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index d49ddf1..46a6bd7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -64,12 +64,15 @@ where
/// section
///
/// This operation is zero cost and doesn't impose any additional blocking
- pub fn borrow<'cs, SCEILING>(
+ pub fn borrow<'cs, PRIORITY, SCEILING>(
&'static self,
+ _priority: &P<PRIORITY>,
_system_ceiling: &'cs C<SCEILING>,
) -> &'cs T
where
SCEILING: GreaterThanOrEqual<CEILING>,
+ CEILING: GreaterThanOrEqual<PRIORITY>,
+ P<PRIORITY>: Priority,
{
unsafe { &*self.data.get() }
}
@@ -216,12 +219,14 @@ where
C<CEILING>: Ceiling,
{
/// See [Resource.borrow](./struct.Resource.html#method.borrow)
- pub fn borrow<'cs, SCEILING>(
+ pub fn borrow<'cs, PRIORITY, SCEILING>(
&'static self,
+ _priority: &P<PRIORITY>,
_system_ceiling: &'cs C<SCEILING>,
) -> &'cs Periph
where
SCEILING: GreaterThanOrEqual<CEILING>,
+ CEILING: GreaterThanOrEqual<PRIORITY>,
{
unsafe { &*self.peripheral.get() }
}