firmware: ti_sci: Fix an off-by-one in ti_sci_debugfs_create()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Mon, 30 Oct 2023 10:12:26 +0000 (11:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 23:35:20 +0000 (15:35 -0800)
commit7615536a37468e98a0296fc05c98251bc8760319
tree3ccb8a5058973569be50893f3e6abd502a2e95dc
parent1c83c7089dea47b7b900001bc2f9da361cb40e4c
firmware: ti_sci: Fix an off-by-one in ti_sci_debugfs_create()

[ Upstream commit 964946b88887089f447a9b6a28c39ee97dc76360 ]

The ending NULL is not taken into account by strncat(), so switch to
snprintf() to correctly build 'debug_name'.

Using snprintf() also makes the code more readable.

Fixes: aa276781a64a ("firmware: Add basic support for TI System Control Interface (TI-SCI) protocol")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/7158db0a4d7b19855ddd542ec61b666973aad8dc.1698660720.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/firmware/ti_sci.c