devlink: Add helper function for safely copy string param
authorMoshe Shemesh <moshe@mellanox.com>
Wed, 10 Oct 2018 13:09:27 +0000 (16:09 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 10 Oct 2018 17:19:10 +0000 (10:19 -0700)
commitbde74ad10eb55aaa472c37b107934e6b8563c25e
tree834c7d34a735b3be2621f897c76275bd6427f694
parent1276534c988ba752fa01bf090412a877ee783829
devlink: Add helper function for safely copy string param

Devlink string param buffer is allocated at the size of
DEVLINK_PARAM_MAX_STRING_VALUE. Add helper function which makes sure
this size is not exceeded.
Renamed DEVLINK_PARAM_MAX_STRING_VALUE to
__DEVLINK_PARAM_MAX_STRING_VALUE to emphasize that it should be used by
devlink only. The driver should use the helper function instead to
verify it doesn't exceed the allowed length.

Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/devlink.h
net/core/devlink.c