diff options
author | Leon Romanovsky <leonro@mellanox.com> | 2017-06-27 16:49:53 +0300 |
---|---|---|
committer | Leon Romanovsky <leon@kernel.org> | 2017-08-10 13:28:10 +0300 |
commit | 9abb0d1bbd9529c574eacd8586e2bf68d17966cd (patch) | |
tree | c7622f72d10e1ce95302053e6b314754ce3c90ee /drivers/infiniband/hw/mlx4/main.c | |
parent | ac50525374315b9b609747f83b07f8dccb06b722 (diff) | |
download | op-kernel-dev-9abb0d1bbd9529c574eacd8586e2bf68d17966cd.zip op-kernel-dev-9abb0d1bbd9529c574eacd8586e2bf68d17966cd.tar.gz |
RDMA: Simplify get firmware interface
There is a need to forward FW version to user space
application through RDMA netlink. In order to make it safe, there
is need to declare nla_policy and limit the size of FW string.
The new define IB_FW_VERSION_NAME_MAX will limit the size of
FW version string. That define was chosen to be equal to
ETHTOOL_FWVERS_LEN, because many drivers anyway are limited
by that value indirectly.
The introduction of this define allows us to remove the string size
from get_fw_str function signature.
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Diffstat (limited to 'drivers/infiniband/hw/mlx4/main.c')
-rw-r--r-- | drivers/infiniband/hw/mlx4/main.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 1f25a37..c636842 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c @@ -2587,12 +2587,11 @@ static int mlx4_port_immutable(struct ib_device *ibdev, u8 port_num, return 0; } -static void get_fw_ver_str(struct ib_device *device, char *str, - size_t str_len) +static void get_fw_ver_str(struct ib_device *device, char *str) { struct mlx4_ib_dev *dev = container_of(device, struct mlx4_ib_dev, ib_dev); - snprintf(str, str_len, "%d.%d.%d", + snprintf(str, IB_FW_VERSION_NAME_MAX, "%d.%d.%d", (int) (dev->dev->caps.fw_ver >> 32), (int) (dev->dev->caps.fw_ver >> 16) & 0xffff, (int) dev->dev->caps.fw_ver & 0xffff); |