nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-nuttx] patacongo commented on a change in pull request #741: Feature/fix wd start casts
Date Mon, 06 Apr 2020 14:15:36 GMT
patacongo commented on a change in pull request #741: Feature/fix wd start casts
URL: https://github.com/apache/incubator-nuttx/pull/741#discussion_r404108953
 
 

 ##########
 File path: sched/pthread/pthread_condtimedwait.c
 ##########
 @@ -67,61 +68,73 @@
  *
  ****************************************************************************/
 
-static void pthread_condtimedout(int argc, uint32_t pid, uint32_t signo)
+static void pthread_condtimedout(int argc, wdparm_t arg1, ...)
 {
-#ifdef HAVE_GROUP_MEMBERS
+  uint32_t pid = (uint32_t)arg1;
+  uint32_t signo;
+  va_list ap;
 
-  FAR struct tcb_s *tcb;
-  siginfo_t info;
+  /* Retrieve the variadic argument */
 
-  /* The logic below if equivalent to nxsig_queue(), but uses
-   * nxsig_tcbdispatch() instead of nxsig_dispatch().  This avoids the group
-   * signal deliver logic and assures, instead, that the signal is delivered
-   * specifically to this thread that is known to be waiting on the signal.
-   */
+  va_start(ap, arg1);
+  signo = (uint32_t)va_arg(ap, uint32_t);
 
 Review comment:
   Actual type is wdparm_t.  It will be a 64-bit uintpr_t on 64-bit machines, and 32-bits
on others.  I don't think you can guarantee that uint32_t will always be correct.  Depending
on endian-ness, this could grab the wrong 32-bits of the 32-bit value.
   
   My guess is that this will work on the 64-bit simulation, but only because it is little
endian and you will probably get the least significant 32-bits which hold the correct signal
number.
   
   The existing code has a similar issue since the parameter was received as a uint32_t but
does work fine on a 64-bit simulator.  I think that was only lucky.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message