mlx4: Use snprintf instead of complicated strcpy
authorQian Cai <cai@gmx.us>
Fri, 30 Nov 2018 02:18:07 +0000 (21:18 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 21 Dec 2019 09:41:26 +0000 (10:41 +0100)
commit672c7bd255c602e963bf630cb7bde4501fd3dbb0
tree751931629397c08f01717d15613e0ecf85046f2c
parent47ebdd7ee39c11d4ab832e569389adc4b5c49439
mlx4: Use snprintf instead of complicated strcpy

[ Upstream commit 0fbc9b8b4ea3f688a5da141a64f97aa33ad02ae9 ]

This fixes a compilation warning in sysfs.c

drivers/infiniband/hw/mlx4/sysfs.c:360:2: warning: 'strncpy' output may be
truncated copying 8 bytes from a string of length 31
[-Wstringop-truncation]

By eliminating the temporary stack buffer.

Signed-off-by: Qian Cai <cai@gmx.us>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/mlx4/sysfs.c