Skip to contentSkip to conversation

tools: image-host.c: use correct variable for strerrno

PATCH New Philippe Reynes 3 participants 3 messages Nov 13, 2020 – Nov 20, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: image-host.c: use correct variable for strerrno

In the function get_random_data, strerrno is called with the variable ret (which is the return of the function clock_gettime). It should be called with errnor. This commit fixes this mistake.

Reported-by Coverity (CID: 312956)
---
 tools/image-host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/image-host.c +1 -1
index 7cef78eab8..24079b8a27 100644
@@ -335,7 +335,7 @@ static int get_random_data(void *data, int size)
 	ret = clock_gettime(CLOCK_MONOTONIC, &date);
 	if (ret < 0) {
 		printf("%s: clock_gettime has failed (err=%d, str=%s)\n",
-		       __func__, ret, strerror(ret));
+		       __func__, ret, strerror(errno));
 		goto out;
 	}
 
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 tools: image-host.c: use correct variable for strerrno

Hi Philippe,

Quoted 11 lines · Philippe Reynes

In the function get_random_data, strerrno is called with the variable ret (which is the return of the function clock_gettime). It should be called with errnor. This commit fixes this mistake.

Reported-by Coverity (CID: 312956)
---
 tools/image-host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#2 lore raw

PATCH 1/1 tools: image-host.c: use correct variable for strerrno

In reply to Philippe Reynes
Quoted 8 lines · Philippe Reynes

In the function get_random_data, strerrno is called with the variable ret (which is the return of the function clock_gettime). It should be called with errnor. This commit fixes this mistake.

Reported-by Coverity (CID: 312956)

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201119/d090001d/attachment-0001.sig>