[PATCH v3] target/iscsi: use get_random_u32() where appropriate

David Carlier posted 1 patch 2 months, 1 week ago
drivers/target/iscsi/iscsi_target_seq_pdu_list.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v3] target/iscsi: use get_random_u32() where appropriate
Posted by David Carlier 2 months, 1 week ago
Use the typed random integer helpers instead of
get_random_bytes() when filling a single integer variable.
The helpers return the value directly, require no pointer
or size argument, and better express intent.

Signed-off-by: David Carlier <devnexen@gmail.com>
---
 drivers/target/iscsi/iscsi_target_seq_pdu_list.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/iscsi/iscsi_target_seq_pdu_list.c b/drivers/target/iscsi/iscsi_target_seq_pdu_list.c
index 75c37c8866c8..81e28e567a01 100644
--- a/drivers/target/iscsi/iscsi_target_seq_pdu_list.c
+++ b/drivers/target/iscsi/iscsi_target_seq_pdu_list.c
@@ -102,7 +102,7 @@ static void iscsit_create_random_array(u32 *array, u32 count)
 
 	for (i = 0; i < count; i++) {
 redo:
-		get_random_bytes(&j, sizeof(u32));
+		j = get_random_u32();
 		j = (1 + (int) (9999 + 1) - j) % count;
 		for (k = 0; k < i + 1; k++) {
 			j |= 0x80000000;
-- 
2.53.0