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/08/16 10:38:21 UTC

[GitHub] [incubator-nuttx-apps] Weizihan opened a new pull request, #1282: apps: Fix bug by calling getrandom

Weizihan opened a new pull request, #1282:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1282

   Signed-off-by: weizihan <we...@xiaomi.com>
   
   ## Summary
   fsutils/mkgpt/mkgpt.c
   Fix bug by calling getrandom
   
   ## Impact
   mkgpt.c  calling getrandom 
   
   ## Testing
   passed vela 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-apps] xiaoxiang781216 commented on a diff in pull request #1282: apps: Fix bug by calling getrandom

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


##########
fsutils/mkgpt/mkgpt.c:
##########
@@ -128,12 +129,12 @@ static const uint8_t g_partition_type_swap[16] =
 
 static void get_uuid(FAR uint8_t *uuid)
 {
-  int fd;
-  fd = open("/dev/urandom", O_RDONLY);
-  if (fd > 0)
+  /* call getrandom to read  /dev/urandom */
+
+  if (getrandom(uuid, 16, GRND_NONBLOCK) < 0)

Review Comment:
   ```suggestion
     if (getrandom(uuid, 16, 0) < 0)
   ```



-- 
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-apps] xiaoxiang781216 merged pull request #1282: apps: Fix bug by calling getrandom

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


-- 
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-apps] Weizihan commented on a diff in pull request #1282: apps: Fix bug by calling getrandom

Posted by GitBox <gi...@apache.org>.
Weizihan commented on code in PR #1282:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1282#discussion_r947425651


##########
fsutils/mkgpt/mkgpt.c:
##########
@@ -128,12 +129,12 @@ static const uint8_t g_partition_type_swap[16] =
 
 static void get_uuid(FAR uint8_t *uuid)
 {
-  int fd;
-  fd = open("/dev/urandom", O_RDONLY);
-  if (fd > 0)
+  /* call getrandom to read  /dev/urandom */

Review Comment:
   Yes



-- 
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-apps] pkarashchenko commented on a diff in pull request #1282: apps: Fix bug by calling getrandom

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


##########
fsutils/mkgpt/mkgpt.c:
##########
@@ -128,12 +129,12 @@ static const uint8_t g_partition_type_swap[16] =
 
 static void get_uuid(FAR uint8_t *uuid)
 {
-  int fd;
-  fd = open("/dev/urandom", O_RDONLY);
-  if (fd > 0)
+  /* call getrandom to read  /dev/urandom */
+
+  if (getrandom(uuid, 16, GRND_NONBLOCK) < 0)

Review Comment:
   Yes. This gets back to original behaviour 



-- 
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-apps] davids5 commented on a diff in pull request #1282: apps: Fix bug by calling getrandom

Posted by GitBox <gi...@apache.org>.
davids5 commented on code in PR #1282:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1282#discussion_r946622835


##########
fsutils/mkgpt/mkgpt.c:
##########
@@ -128,12 +129,12 @@ static const uint8_t g_partition_type_swap[16] =
 
 static void get_uuid(FAR uint8_t *uuid)
 {
-  int fd;
-  fd = open("/dev/urandom", O_RDONLY);
-  if (fd > 0)
+  /* call getrandom to read  /dev/urandom */

Review Comment:
   Is the comment correct any longer?



-- 
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-apps] pkarashchenko commented on a diff in pull request #1282: apps: Fix bug by calling getrandom

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


##########
fsutils/mkgpt/mkgpt.c:
##########
@@ -128,12 +129,12 @@ static const uint8_t g_partition_type_swap[16] =
 
 static void get_uuid(FAR uint8_t *uuid)
 {
-  int fd;
-  fd = open("/dev/urandom", O_RDONLY);
-  if (fd > 0)
+  /* call getrandom to read  /dev/urandom */
+
+  if (getrandom(uuid, 16, 1) < 0)

Review Comment:
   ```suggestion
     if (getrandom(uuid, 16, GRND_NONBLOCK) < 0)
   ```



##########
fsutils/mkgpt/mkgpt.c:
##########
@@ -128,12 +129,12 @@ static const uint8_t g_partition_type_swap[16] =
 
 static void get_uuid(FAR uint8_t *uuid)
 {
-  int fd;
-  fd = open("/dev/urandom", O_RDONLY);
-  if (fd > 0)
+  /* call getrandom to read  /dev/urandom */
+
+  if (getrandom(uuid, 16, 1) < 0)

Review Comment:
   But current code is different from the original one that was a blocking read.



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