]> git.baikalelectronics.ru Git - kernel.git/commit
platform/mellanox: mlxbf-pmc: Fix potential buffer overflows
authorShravan Kumar Ramani <shravankr@nvidia.com>
Tue, 5 Sep 2023 12:49:32 +0000 (08:49 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Sep 2023 10:28:09 +0000 (12:28 +0200)
commit3f16330a4869e08d646d91b2637e49c20c5ffd65
tree6a1f92b472f2bc91bb15add1b2481f0c6d274743
parent3a45dcfb4d3cbe683b082ccde6a724534b73e4f9
platform/mellanox: mlxbf-pmc: Fix potential buffer overflows

[ Upstream commit 80ccd40568bcd3655b0fd0be1e9b3379fd6e1056 ]

Replace sprintf with sysfs_emit where possible.
Size check in mlxbf_pmc_event_list_show should account for "\0".

Fixes: 1a218d312e65 ("platform/mellanox: mlxbf-pmc: Add Mellanox BlueField PMC driver")
Signed-off-by: Shravan Kumar Ramani <shravankr@nvidia.com>
Reviewed-by: Vadim Pasternak <vadimp@nvidia.com>
Reviewed-by: David Thompson <davthompson@nvidia.com>
Link: https://lore.kernel.org/r/bef39ef32319a31b32f999065911f61b0d3b17c3.1693917738.git.shravankr@nvidia.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/platform/mellanox/mlxbf-pmc.c