Skip to content

Commit 197173d

Browse files
committed
treewide: use get_random_bytes() when possible
The prandom_bytes() function has been a deprecated inline wrapper around get_random_bytes() for several releases now, and compiles down to the exact same code. Replace the deprecated wrapper with a direct call to the real function. This was done as a basic find and replace. Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Yury Norov <yury.norov@gmail.com> Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu> # powerpc Acked-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
1 parent a251c17 commit 197173d

File tree

19 files changed

+24
-24
lines changed

19 files changed

+24
-24
lines changed

arch/powerpc/crypto/crc-vpmsum_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static int __init crc_test_init(void)
8282

8383
if (len <= offset)
8484
continue;
85-
prandom_bytes(data, len);
85+
get_random_bytes(data, len);
8686
len -= offset;
8787

8888
crypto_shash_update(crct10dif_shash, data+offset, len);

block/blk-crypto-fallback.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ static int blk_crypto_fallback_init(void)
539539
if (blk_crypto_fallback_inited)
540540
return 0;
541541

542-
prandom_bytes(blank_key, BLK_CRYPTO_MAX_KEY_SIZE);
542+
get_random_bytes(blank_key, BLK_CRYPTO_MAX_KEY_SIZE);
543543

544544
err = bioset_init(&crypto_bio_split, 64, 0, 0);
545545
if (err)

crypto/async_tx/raid6test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static void makedata(int disks)
3737
int i;
3838

3939
for (i = 0; i < disks; i++) {
40-
prandom_bytes(page_address(data[i]), PAGE_SIZE);
40+
get_random_bytes(page_address(data[i]), PAGE_SIZE);
4141
dataptrs[i] = data[i];
4242
dataoffs[i] = 0;
4343
}

drivers/dma/dmatest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ static unsigned long dmatest_random(void)
312312
{
313313
unsigned long buf;
314314

315-
prandom_bytes(&buf, sizeof(buf));
315+
get_random_bytes(&buf, sizeof(buf));
316316
return buf;
317317
}
318318

drivers/mtd/nand/raw/nandsim.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1393,7 +1393,7 @@ static int ns_do_read_error(struct nandsim *ns, int num)
13931393
unsigned int page_no = ns->regs.row;
13941394

13951395
if (ns_read_error(page_no)) {
1396-
prandom_bytes(ns->buf.byte, num);
1396+
get_random_bytes(ns->buf.byte, num);
13971397
NS_WARN("simulating read error in page %u\n", page_no);
13981398
return 1;
13991399
}

drivers/mtd/tests/mtd_nandecctest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ static int nand_ecc_test_run(const size_t size)
266266
goto error;
267267
}
268268

269-
prandom_bytes(correct_data, size);
269+
get_random_bytes(correct_data, size);
270270
ecc_sw_hamming_calculate(correct_data, size, correct_ecc, sm_order);
271271
for (i = 0; i < ARRAY_SIZE(nand_ecc_test); i++) {
272272
nand_ecc_test[i].prepare(error_data, error_ecc,

drivers/mtd/tests/speedtest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ static int __init mtd_speedtest_init(void)
223223
if (!iobuf)
224224
goto out;
225225

226-
prandom_bytes(iobuf, mtd->erasesize);
226+
get_random_bytes(iobuf, mtd->erasesize);
227227

228228
bbt = kzalloc(ebcnt, GFP_KERNEL);
229229
if (!bbt)

drivers/mtd/tests/stresstest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ static int __init mtd_stresstest_init(void)
183183
goto out;
184184
for (i = 0; i < ebcnt; i++)
185185
offsets[i] = mtd->erasesize;
186-
prandom_bytes(writebuf, bufsize);
186+
get_random_bytes(writebuf, bufsize);
187187

188188
bbt = kzalloc(ebcnt, GFP_KERNEL);
189189
if (!bbt)

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3874,7 +3874,7 @@ static void bnxt_init_vnics(struct bnxt *bp)
38743874

38753875
if (bp->vnic_info[i].rss_hash_key) {
38763876
if (i == 0)
3877-
prandom_bytes(vnic->rss_hash_key,
3877+
get_random_bytes(vnic->rss_hash_key,
38783878
HW_HASH_KEY_SIZE);
38793879
else
38803880
memcpy(vnic->rss_hash_key,

drivers/net/ethernet/rocker/rocker_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ static int rocker_dma_test_offset(const struct rocker *rocker,
224224
if (err)
225225
goto unmap;
226226

227-
prandom_bytes(buf, ROCKER_TEST_DMA_BUF_SIZE);
227+
get_random_bytes(buf, ROCKER_TEST_DMA_BUF_SIZE);
228228
for (i = 0; i < ROCKER_TEST_DMA_BUF_SIZE; i++)
229229
expect[i] = ~buf[i];
230230
err = rocker_dma_test_one(rocker, wait, ROCKER_TEST_DMA_CTRL_INVERT,

0 commit comments

Comments
 (0)