You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/03/08 21:31:17 UTC

[GitHub] [incubator-nuttx] pkarashchenko opened a new pull request #5697: boards/arm/stm32[f7|l4]: fix SPI chip select GPIO access

pkarashchenko opened a new pull request #5697:
URL: https://github.com/apache/incubator-nuttx/pull/5697


   ## Summary
   Out of bound array access happen for some of STM32 based boards during SPI chip select operation.
   
   ## Impact
   SMT32 based boards that use SPI.
   
   ## Testing
   Pass CI
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #5697: boards/arm/stm32[f7|l4]: fix SPI chip select GPIO access

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #5697:
URL: https://github.com/apache/incubator-nuttx/pull/5697


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] acassis commented on a change in pull request #5697: boards/arm/stm32[f7|l4]: fix SPI chip select GPIO access

Posted by GitBox <gi...@apache.org>.
acassis commented on a change in pull request #5697:
URL: https://github.com/apache/incubator-nuttx/pull/5697#discussion_r822196777



##########
File path: boards/arm/stm32/nucleo-f429zi/src/stm32_spi.c
##########
@@ -217,35 +248,41 @@ uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
 
 #ifdef CONFIG_STM32F4_SPI2
 void stm32_spi2select(FAR struct spi_dev_s *dev,
-                      uint32_t devid,
-                      bool selected)
+                      uint32_t devid, bool selected)
 {
+  uint32_t index = SPIDEVID_INDEX(devid) + 4;
+

Review comment:
       @pkarashchenko instead of using this fixed "+ 4" offset to skip the 4 SPI1 chip select, it is better to create an array for each SPI port: g_spi1gpio[], g_spi2gpio[], g_spi3gpio[], etc. This way the users could add more than 4 Chip Select without doing this fixed skip.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] pkarashchenko commented on a change in pull request #5697: boards/arm/stm32[f7|l4]: fix SPI chip select GPIO access

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5697:
URL: https://github.com/apache/incubator-nuttx/pull/5697#discussion_r822811715



##########
File path: boards/arm/stm32/nucleo-f429zi/src/stm32_spi.c
##########
@@ -217,35 +248,41 @@ uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
 
 #ifdef CONFIG_STM32F4_SPI2
 void stm32_spi2select(FAR struct spi_dev_s *dev,
-                      uint32_t devid,
-                      bool selected)
+                      uint32_t devid, bool selected)
 {
+  uint32_t index = SPIDEVID_INDEX(devid) + 4;
+

Review comment:
       Done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] pkarashchenko commented on a change in pull request #5697: boards/arm/stm32[f7|l4]: fix SPI chip select GPIO access

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5697:
URL: https://github.com/apache/incubator-nuttx/pull/5697#discussion_r822332740



##########
File path: boards/arm/stm32/nucleo-f429zi/src/stm32_spi.c
##########
@@ -217,35 +248,41 @@ uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
 
 #ifdef CONFIG_STM32F4_SPI2
 void stm32_spi2select(FAR struct spi_dev_s *dev,
-                      uint32_t devid,
-                      bool selected)
+                      uint32_t devid, bool selected)
 {
+  uint32_t index = SPIDEVID_INDEX(devid) + 4;
+

Review comment:
       Ok. I will rework.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org