bnxt_en: Use memcpy to copy VPD field info.
authorVasundhara Volam <vasundhara-v.volam@broadcom.com>
Mon, 21 Sep 2020 01:08:54 +0000 (21:08 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 26 Sep 2020 16:05:25 +0000 (18:05 +0200)
commit693ba8c81ca3b139de961e6966d046e935618609
treeb4bc4df2ba17faa4f3ed0c7e86c63d9ab637e9db
parent6229623f54cb75a0472fff673649be3bbacf0c03
bnxt_en: Use memcpy to copy VPD field info.

[ Upstream commit 492adcf481292521ee8df1a482dc12acdb28aa15 ]

Using strlcpy() to copy from VPD is not correct because VPD strings
are not necessarily NULL terminated.  Use memcpy() to copy the VPD
length up to the destination buffer size - 1.  The destination is
zeroed memory so it will always be NULL terminated.

Fixes: a0d0fd70fed5 ("bnxt_en: Read partno and serialno of the board from VPD")
Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/broadcom/bnxt/bnxt.c