Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 973e574e authored by Michael Chan's avatar Michael Chan Committed by David S. Miller
Browse files

cnic: Replace get_random_bytes() with random32()



Suggested by Stephen Hemminger <shemminger@vyatta.com>

Signed-off-by: default avatarMichael Chan <mchan@broadcom.com>
Reviewed-by: default avatarMatt Carlson <mcarlson@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 10d1e8ca
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -28,6 +28,7 @@
#include <linux/ethtool.h>
#include <linux/ethtool.h>
#include <linux/if_vlan.h>
#include <linux/if_vlan.h>
#include <linux/prefetch.h>
#include <linux/prefetch.h>
#include <linux/random.h>
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
#define BCM_VLAN 1
#define BCM_VLAN 1
#endif
#endif
@@ -3830,7 +3831,7 @@ static int cnic_cm_alloc_mem(struct cnic_dev *dev)
	if (!cp->csk_tbl)
	if (!cp->csk_tbl)
		return -ENOMEM;
		return -ENOMEM;


	get_random_bytes(&port_id, sizeof(port_id));
	port_id = random32();
	port_id %= CNIC_LOCAL_PORT_RANGE;
	port_id %= CNIC_LOCAL_PORT_RANGE;
	if (cnic_init_id_tbl(&cp->csk_port_tbl, CNIC_LOCAL_PORT_RANGE,
	if (cnic_init_id_tbl(&cp->csk_port_tbl, CNIC_LOCAL_PORT_RANGE,
			     CNIC_LOCAL_PORT_MIN, port_id)) {
			     CNIC_LOCAL_PORT_MIN, port_id)) {
@@ -3890,7 +3891,7 @@ static int cnic_cm_init_bnx2_hw(struct cnic_dev *dev)
{
{
	u32 seed;
	u32 seed;


	get_random_bytes(&seed, 4);
	seed = random32();
	cnic_ctx_wr(dev, 45, 0, seed);
	cnic_ctx_wr(dev, 45, 0, seed);
	return 0;
	return 0;
}
}