]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tools: image-host.c: use random instead of rand
authorPhilippe Reynes <philippe.reynes@softathome.com>
Fri, 13 Nov 2020 15:37:46 +0000 (16:37 +0100)
committerTom Rini <trini@konsulko.com>
Thu, 19 Nov 2020 14:45:49 +0000 (09:45 -0500)
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>
tools/image-host.c

index 7cef78eab8f98d5f5796fbf58e7de11b5f040b2c..5e1dec233840ce560e167962d4804d1f9d4f4fc4 100644 (file)
@@ -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++;
        }