diff options
| author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2018-12-12 11:42:21 +0000 |
|---|---|---|
| committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2018-12-12 11:42:21 +0000 |
| commit | 9565aedc5e9ba8632d9662056005784d866a1884 (patch) | |
| tree | 421fe82ba5273638effb0338bbeb6e2e707534d8 /sys/dev/mlx4 | |
| parent | b87eced24d5646ac6043fd66785fb72b905ea374 (diff) | |
Notes
Diffstat (limited to 'sys/dev/mlx4')
| -rw-r--r-- | sys/dev/mlx4/mlx4_core/mlx4_cmd.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/mlx4/mlx4_core/mlx4_cmd.c b/sys/dev/mlx4/mlx4_core/mlx4_cmd.c index 6f972a0f3da1..36f73822607b 100644 --- a/sys/dev/mlx4/mlx4_core/mlx4_cmd.c +++ b/sys/dev/mlx4/mlx4_core/mlx4_cmd.c @@ -961,6 +961,8 @@ static int mlx4_MAD_IFC_wrapper(struct mlx4_dev *dev, int slave, if (!err && slave != mlx4_master_func_num(dev)) { u8 *state = outsmp->data + PORT_STATE_OFFSET; + if (port < 1 || port > dev->caps.num_ports) + return -EINVAL; *state = (*state & 0xf0) | vf_port_state(dev, port, slave); slave_cap_mask = priv->mfunc.master.slave_state[slave].ib_cap_mask[port]; memcpy(outsmp->data + PORT_CAPABILITY_LOCATION_IN_SMP, &slave_cap_mask, 4); @@ -968,8 +970,12 @@ static int mlx4_MAD_IFC_wrapper(struct mlx4_dev *dev, int slave, return err; } if (smp->attr_id == IB_SMP_ATTR_GUID_INFO) { - __be64 guid = mlx4_get_admin_guid(dev, slave, - port); + __be64 guid; + + if (port < 1 || port > dev->caps.num_ports) + return -EINVAL; + + guid = mlx4_get_admin_guid(dev, slave, port); /* set the PF admin guid to the FW/HW burned * GUID, if it wasn't yet set |
