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/07/05 14:54:50 UTC

[GitHub] [incubator-nuttx] chengli1212 opened a new pull request, #6574: add empty ioctl for mmcsd_spi

chengli1212 opened a new pull request, #6574:
URL: https://github.com/apache/incubator-nuttx/pull/6574

   fix crash when use ioctl without null point check
   
   ## Summary
   some third party software use block driver ioctl directly without null point check
   ## Impact
   crash when call ioctl directly
   ## Testing
   test done at bes m0 board
   


-- 
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 commented on a diff in pull request #6574: add empty ioctl for mmcsd_spi

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6574:
URL: https://github.com/apache/incubator-nuttx/pull/6574#discussion_r913908881


##########
drivers/mmcsd/mmcsd_spi.c:
##########
@@ -1604,6 +1606,20 @@ static int mmcsd_geometry(FAR struct inode *inode, struct geometry *geometry)
   return OK;
 }
 
+/****************************************************************************
+ * Name: mmcsd_ioctl
+ *
+ * Description: Return device geometry
+ *
+ ****************************************************************************/
+
+static int mmcsd_ioctl(FAR struct inode *inode, int cmd, unsigned long arg)
+{
+  fwarn("Not implement, cmd:%d, arg:0x%x\n", cmd, arg);
+
+  return 0;

Review Comment:
   let's return -ENOTTY



-- 
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] chengli1212 commented on a diff in pull request #6574: add empty ioctl for mmcsd_spi

Posted by GitBox <gi...@apache.org>.
chengli1212 commented on code in PR #6574:
URL: https://github.com/apache/incubator-nuttx/pull/6574#discussion_r913914632


##########
drivers/mmcsd/mmcsd_spi.c:
##########
@@ -1604,6 +1606,20 @@ static int mmcsd_geometry(FAR struct inode *inode, struct geometry *geometry)
   return OK;
 }
 
+/****************************************************************************
+ * Name: mmcsd_ioctl
+ *
+ * Description: Return device geometry
+ *
+ ****************************************************************************/
+
+static int mmcsd_ioctl(FAR struct inode *inode, int cmd, unsigned long arg)
+{
+  fwarn("Not implement, cmd:%d, arg:0x%x\n", cmd, arg);
+
+  return 0;

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] chengli1212 commented on a diff in pull request #6574: add empty ioctl for mmcsd_spi

Posted by GitBox <gi...@apache.org>.
chengli1212 commented on code in PR #6574:
URL: https://github.com/apache/incubator-nuttx/pull/6574#discussion_r915555909


##########
drivers/mmcsd/mmcsd_spi.c:
##########
@@ -215,7 +217,7 @@ static const struct block_operations g_bops =
   NULL,           /* write    */
 #endif
   mmcsd_geometry, /* geometry */
-  NULL            /* ioctl    */
+  mmcsd_ioctl,    /* ioctl    */

Review Comment:
   OK. It's maybe good. I will close this PR.



-- 
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] chengli1212 closed pull request #6574: add empty ioctl for mmcsd_spi

Posted by GitBox <gi...@apache.org>.
chengli1212 closed pull request #6574: add empty ioctl for mmcsd_spi
URL: https://github.com/apache/incubator-nuttx/pull/6574


-- 
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 diff in pull request #6574: add empty ioctl for mmcsd_spi

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6574:
URL: https://github.com/apache/incubator-nuttx/pull/6574#discussion_r914646759


##########
drivers/mmcsd/mmcsd_spi.c:
##########
@@ -215,7 +217,7 @@ static const struct block_operations g_bops =
   NULL,           /* write    */
 #endif
   mmcsd_geometry, /* geometry */
-  NULL            /* ioctl    */
+  mmcsd_ioctl,    /* ioctl    */

Review Comment:
   Maybe NULL check should be added instead of adding empty stubs?



-- 
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 diff in pull request #6574: add empty ioctl for mmcsd_spi

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6574:
URL: https://github.com/apache/incubator-nuttx/pull/6574#discussion_r915094793


##########
drivers/mmcsd/mmcsd_spi.c:
##########
@@ -215,7 +217,7 @@ static const struct block_operations g_bops =
   NULL,           /* write    */
 #endif
   mmcsd_geometry, /* geometry */
-  NULL            /* ioctl    */
+  mmcsd_ioctl,    /* ioctl    */

Review Comment:
   I mean that with this change we are trying to fit the upper level third party driver.
   I see that most of the places in code use code like
   ```
         if (drv->u.i_bops->ioctl != NULL)
           {
             return drv->u.i_bops->ioctl(drv, cmd, arg);
           }
   ```
   so I'm wondering maybe the third party driver should check for NULL as well instead of adding a stub here.



-- 
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 diff in pull request #6574: add empty ioctl for mmcsd_spi

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6574:
URL: https://github.com/apache/incubator-nuttx/pull/6574#discussion_r915091764


##########
drivers/mmcsd/mmcsd_spi.c:
##########
@@ -215,7 +217,7 @@ static const struct block_operations g_bops =
   NULL,           /* write    */
 #endif
   mmcsd_geometry, /* geometry */
-  NULL            /* ioctl    */
+  mmcsd_ioctl,    /* ioctl    */

Review Comment:
   ```suggestion
     mmcsd_ioctl     /* ioctl    */
   ```



-- 
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 commented on a diff in pull request #6574: add empty ioctl for mmcsd_spi

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6574:
URL: https://github.com/apache/incubator-nuttx/pull/6574#discussion_r915059699


##########
drivers/mmcsd/mmcsd_spi.c:
##########
@@ -1604,6 +1606,20 @@ static int mmcsd_geometry(FAR struct inode *inode, struct geometry *geometry)
   return OK;
 }
 
+/****************************************************************************
+ * Name: mmcsd_ioctl
+ *
+ * Description: Return device geometry
+ *
+ ****************************************************************************/
+
+static int mmcsd_ioctl(FAR struct inode *inode, int cmd, unsigned long arg)
+{
+  fwarn("Not implement, cmd:%d, arg=0x%" PRIx32 "\n", cmd, arg);

Review Comment:
   fwarn("Not implement, cmd:%d, arg=0x%lu\n", cmd, arg);



-- 
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