Message ID | 20210514014011.2832707-5-sjg@chromium.org |
---|---|
State | Accepted |
Commit | 2177f924bf585d083fdbb3c1ff1479794ee8ccac |
Delegated to: | Tom Rini |
Headers | show |
Series | [v2,01/16] sandbox: net: Ensure host name is always a valid string | expand |
On Thu, May 13, 2021 at 07:39:23PM -0600, Simon Glass wrote: > There is no good reason to use a sequence from rand() here. We may as well > invent our own sequence. > > This should molify Coverity which does not use rand() being used. > > Signed-off-by: Simon Glass <sjg@chromium.org> > Reported-by: Coverity (CID: 312949) Applied to u-boot/master, thanks!
diff --git a/test/dm/regmap.c b/test/dm/regmap.c index 372a73ca0c3..04bb1645d1b 100644 --- a/test/dm/regmap.c +++ b/test/dm/regmap.c @@ -306,9 +306,8 @@ static int dm_test_devm_regmap(struct unit_test_state *uts) &dev)); priv = dev_get_priv(dev); - srand(get_ticks() + rand()); for (i = 0; i < REGMAP_TEST_BUF_SZ; i++) { - pattern[i] = rand(); + pattern[i] = i * 0x87654321; ut_assertok(regmap_write(priv->cfg_regmap, i, pattern[i])); } for (i = 0; i < REGMAP_TEST_BUF_SZ; i++) {
There is no good reason to use a sequence from rand() here. We may as well invent our own sequence. This should molify Coverity which does not use rand() being used. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Coverity (CID: 312949) --- (no changes since v1) test/dm/regmap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)