perf: arm-ccn: Use scnprintf() for robustness
authorTakashi Iwai <tiwai@suse.de>
Sun, 15 Mar 2020 09:37:15 +0000 (10:37 +0100)
committerWill Deacon <will@kernel.org>
Tue, 17 Mar 2020 22:45:56 +0000 (22:45 +0000)
commit06236821aeac480a0835dd8dd9fb20e3b5a5d80d
treec02c1fef0dfb0b65164cb5f987ba1b50cea6eb65
parent29cc4ceeac1274ab8363a11b81ebd99f3b023985
perf: arm-ccn: Use scnprintf() for robustness

snprintf() is a hard-to-use function, it's especially difficult to use
it for concatenating substrings in a buffer with a limited size.
Since snprintf() returns the would-be-output size, not the actual
size, the subsequent use of snprintf() may point to the incorrect
position easily.  Although the current code doesn't actually overflow
the buffer, it's an incorrect usage.

This patch replaces such snprintf() calls with a safer version,
scnprintf().

Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Will Deacon <will@kernel.org>
drivers/perf/arm-ccn.c