<div dir="ltr">I'm reverting this.<div><br></div><div>I think this is in a batch that did not get tested before I worked </div><div>with Ryan to correct his <a href="http://procedure.to">procedure.to</a> ensure more testing with</div><div>debug enabled.</div><div><br></div><div>On most he has filed issues with the upstream, but as you note,</div><div>this isn't the right solution so that doesn't matter here. Probably </div><div>best to ifndef rtems around the unsupported features.</div><div><br></div><div>I'm about to push a revert and reopen the ticket.</div><div><br></div><div>--joel</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 24, 2021 at 2:31 AM Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 08/03/2021 21:56, Joel Sherrill wrote:<br>
<br>
> Module: rtems<br>
> Branch: master<br>
> Commit: 597e4f476568a225d14dfaff02074cf269ad62ac<br>
> Changeset:<a href="http://git.rtems.org/rtems/commit/?id=597e4f476568a225d14dfaff02074cf269ad62ac" rel="noreferrer" target="_blank">http://git.rtems.org/rtems/commit/?id=597e4f476568a225d14dfaff02074cf269ad62ac</a><br>
><br>
> Author: Ryan Long<<a href="mailto:ryan.long@oarcorp.com" target="_blank">ryan.long@oarcorp.com</a>><br>
> Date: Tue Mar 2 11:08:28 2021 -0500<br>
><br>
> gen_uuid.c: Fix two Unchecked return value from library errors<br>
><br>
> CID 1049146: Unchecked return value from library in get_clock().<br>
> CID 1049147: Unchecked return value from library in get_random_fd().<br>
><br>
> Closes #4280<br>
><br>
> ---<br>
><br>
> cpukit/libmisc/uuid/gen_uuid.c | 11 ++++++++---<br>
> 1 file changed, 8 insertions(+), 3 deletions(-)<br>
><br>
> diff --git a/cpukit/libmisc/uuid/gen_uuid.c b/cpukit/libmisc/uuid/gen_uuid.c<br>
> index 3ca75a0..5bb34c0 100644<br>
> --- a/cpukit/libmisc/uuid/gen_uuid.c<br>
> +++ b/cpukit/libmisc/uuid/gen_uuid.c<br>
> @@ -155,6 +155,7 @@ static int get_random_fd(void)<br>
> struct timeval tv;<br>
> static int fd = -2;<br>
> int i;<br>
> + int sc;<br>
> <br>
> if (fd == -2) {<br>
> gettimeofday(&tv, 0);<br>
> @@ -164,8 +165,10 @@ static int get_random_fd(void)<br>
> fd = open("/dev/random", O_RDONLY | O_NONBLOCK);<br>
> if (fd >= 0) {<br>
> i = fcntl(fd, F_GETFD);<br>
> - if (i >= 0)<br>
> - fcntl(fd, F_SETFD, i | FD_CLOEXEC);<br>
> + if (i >= 0) {<br>
> + sc = fcntl(fd, F_SETFD, i | FD_CLOEXEC);<br>
> + _Assert_Unused_variable_unequal(sc, -1);<br>
> + }<br>
<br>
FD_CLOEXEC is not supported by RTEMS. Do we even have these device files <br>
in RTEMS? This is 3rd-party code, what about upstream changes?<br>
<br>
> }<br>
> #endif<br>
> srand((getpid() << ((sizeof(pid_t)*CHAR_BIT)>>1)) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec);<br>
> @@ -334,6 +337,7 @@ static int get_clock(uint32_t *clock_high, uint32_t *clock_low,<br>
> uint64_t clock_reg;<br>
> mode_t save_umask;<br>
> int len;<br>
> + int sc;<br>
> <br>
> if (state_fd == -2) {<br>
> save_umask = umask(0);<br>
> @@ -426,7 +430,8 @@ try_again:<br>
> }<br>
> rewind(state_f);<br>
> fl.l_type = F_UNLCK;<br>
> - fcntl(state_fd, F_SETLK, &fl);<br>
> + sc = fcntl(state_fd, F_SETLK, &fl);<br>
> + _Assert_Unused_variable_unequal(sc, -1);<br>
F_SETLK is not supported by RTEMS.<br>
> }<br>
> <br>
> *clock_high = clock_reg >> 32;<br>
<br>
The patch produces warnings like this:<br>
<br>
../../../cpukit/libmisc/uuid/gen_uuid.c: In function 'get_clock':<br>
../../../cpukit/libmisc/uuid/gen_uuid.c:434:3: warning: implicit <br>
declaration of function '_Assert_Unused_variable_unequal' <br>
[-Wimplicit-function-declaration]<br>
434 | _Assert_Unused_variable_unequal(sc, -1);<br>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
../../../cpukit/libmisc/uuid/gen_uuid.c:434:3: warning: nested extern <br>
declaration of '_Assert_Unused_variable_unequal' [-Wnested-externs]<br>
<br>
In total, how was this patch tested?<br>
<br>
If you add _Assert() stuff, please build with RTEMS_DEBUG enabled and <br>
run the tests.<br>
<br>
-- <br>
embedded brains GmbH<br>
Herr Sebastian HUBER<br>
Dornierstr. 4<br>
82178 Puchheim<br>
Germany<br>
email: <a href="mailto:sebastian.huber@embedded-brains.de" target="_blank">sebastian.huber@embedded-brains.de</a><br>
phone: +49-89-18 94 741 - 16<br>
fax: +49-89-18 94 741 - 08<br>
<br>
Registergericht: Amtsgericht München<br>
Registernummer: HRB 157899<br>
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler<br>
Unsere Datenschutzerklärung finden Sie hier:<br>
<a href="https://embedded-brains.de/datenschutzerklaerung/" rel="noreferrer" target="_blank">https://embedded-brains.de/datenschutzerklaerung/</a><br>
<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a></blockquote></div>