soc: qcom: cmd-db: Drop NUL bytes from debugfs output
authorBjorn Andersson <quic_bjorande@quicinc.com>
Tue, 20 Jun 2023 21:37:03 +0000 (14:37 -0700)
committerBjorn Andersson <andersson@kernel.org>
Mon, 10 Jul 2023 04:18:29 +0000 (21:18 -0700)
commitd4600cbd5bcbaa2b296b5cf9a5c04408eedb4ef3
treed69fff8c08d18f7b717a4e7c61d53e84c81b563b
parent98c8b3efacaec61287a096dd37ca3c197f298b70
soc: qcom: cmd-db: Drop NUL bytes from debugfs output

The debugfs dump of Command DB relies uses %*pEp to print the resource
identifiers, with escaping of non-printable characters.
But p (ESCAPE_NP) does not escape NUL characters, so for identifiers
less than 8 bytes in length the output will retain these.

This does not cause an issue while looking at the dump in the terminal
(no known complaints at least), but when programmatically consuming the
debugfs output the extra characters are unwanted.

Change the fixed 8-byte sizeof() to a dynamic strnlen() to avoid
printing these NUL characters.

Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20230620213703.283583-1-quic_bjorande@quicinc.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
drivers/soc/qcom/cmd-db.c