aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-01-07 13:45:07 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-01-07 13:45:07 +0000
commit75bf0b4b576c5912dd3ae061aea41db28019408c (patch)
treea7a443a51cae179cb0eee837c1528ed1813bb580 /os/hal
parentceabd2010131e3ba9bbbc208470d2a9bcdb14fb2 (diff)
downloadChibiOS-75bf0b4b576c5912dd3ae061aea41db28019408c.tar.gz
ChibiOS-75bf0b4b576c5912dd3ae061aea41db28019408c.tar.bz2
ChibiOS-75bf0b4b576c5912dd3ae061aea41db28019408c.zip
Fixed harmless arithmetical overflow in the STM32_DMA_GETCHANNEL() macro.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3759 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal')
-rw-r--r--os/hal/platforms/STM32F2xx/stm32_dma.h2
-rw-r--r--os/hal/platforms/STM32F4xx/stm32_dma.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/os/hal/platforms/STM32F2xx/stm32_dma.h b/os/hal/platforms/STM32F2xx/stm32_dma.h
index d57cae4be..b5f95f0c8 100644
--- a/os/hal/platforms/STM32F2xx/stm32_dma.h
+++ b/os/hal/platforms/STM32F2xx/stm32_dma.h
@@ -54,7 +54,7 @@
* nibble
* @return Returns the channel associated to the stream.
*/
-#define STM32_DMA_GETCHANNEL(id, c) ((c) >> (((id) & 7) * 4))
+#define STM32_DMA_GETCHANNEL(id, c) (((c) & 15) >> (((id) & 7) * 4))
/**
* @brief Returns an unique numeric identifier for a DMA stream.
diff --git a/os/hal/platforms/STM32F4xx/stm32_dma.h b/os/hal/platforms/STM32F4xx/stm32_dma.h
index bcadf153c..16dcea02d 100644
--- a/os/hal/platforms/STM32F4xx/stm32_dma.h
+++ b/os/hal/platforms/STM32F4xx/stm32_dma.h
@@ -54,7 +54,7 @@
* nibble
* @return Returns the channel associated to the stream.
*/
-#define STM32_DMA_GETCHANNEL(id, c) ((c) >> (((id) & 7) * 4))
+#define STM32_DMA_GETCHANNEL(id, c) (((c) & 15) >> (((id) & 7) * 4))
/**
* @brief Returns an unique numeric identifier for a DMA stream.