eth: fbnic: Update fbnic_tlv_attr_get_string() to work like nla_strscpy()
authorLee Trager <lee@trager.us>
Fri, 28 Feb 2025 19:15:27 +0000 (11:15 -0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 5 Mar 2025 01:03:26 +0000 (17:03 -0800)
commite5cf5107c9e4286377d9adae114e524787cbe104
tree064869ec2ed9e382064fd9318aa376d6637046b1
parent56bcc6ecff8fdc06258c637226986ed522027ca5
eth: fbnic: Update fbnic_tlv_attr_get_string() to work like nla_strscpy()

Allow fbnic_tlv_attr_get_string() to return an error code. In the event the
source mailbox attribute is missing return -EINVAL. Like nla_strscpy() return
-E2BIG when the source string is larger than the destination string. In this
case the amount of data copied is equal to dstsize.

Signed-off-by: Lee Trager <lee@trager.us>
Link: https://patch.msgid.link/20250228191935.3953712-3-lee@trager.us
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/meta/fbnic/fbnic_tlv.c
drivers/net/ethernet/meta/fbnic/fbnic_tlv.h