summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPhilippe Reynes <philippe.reynes@softathome.com>2020-11-13 16:37:46 +0100
committerTom Rini <trini@konsulko.com>2020-11-19 09:45:49 -0500
commitcc34f04efd63dfdd31ef2dbfd46c15fb485b2888 (patch)
treec9f172e82f900d2ef7c68106897d6bed24ba07f1 /tools
parent5a7885cca50fbc90c52839c4bef0a2cf316ad4fe (diff)
tools: image-host.c: use random instead of rand
According to the manpage of rand, it is recommended to use random instead of rand. This commit updates the function get_random_data to use random. Reported-by: Coverity (CID: 312953) Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/image-host.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/image-host.c b/tools/image-host.c
index 7cef78eab8..5e1dec2338 100644
--- a/tools/image-host.c
+++ b/tools/image-host.c
@@ -339,10 +339,10 @@ static int get_random_data(void *data, int size)
goto out;
}
- srand(date.tv_nsec);
+ srandom(date.tv_nsec);
for (i = 0; i < size; i++) {
- *tmp = rand() & 0xff;
+ *tmp = random() & 0xff;
tmp++;
}