]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitf17039c10f9f140b62bfc47852e3ac399f4532a8
treec02c1fef0dfb0b65164cb5f987ba1b50cea6eb65
parentd34626411a0080e9bcb5cfe582c22d2a19b37617
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