From 5386e1c177f5803e6d26fe61a7044ce11cb7e232 Mon Sep 17 00:00:00 2001 From: AnilKumar Chimata Date: Tue, 29 Sep 2020 12:31:17 +0530 Subject: [PATCH] firmware: qcom: Fix hyp_log issue While reading the hyp logs few garbage characters were seen due to invalid len computed. This patch fixes the issue by properly computing the len. Change-Id: I2e2f23d069ee45b0c57a7b673248b63eedaf7697 Signed-off-by: AnilKumar Chimata --- drivers/firmware/qcom/tz_log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/qcom/tz_log.c b/drivers/firmware/qcom/tz_log.c index 776b9b0aba43..1335e6f510bc 100644 --- a/drivers/firmware/qcom/tz_log.c +++ b/drivers/firmware/qcom/tz_log.c @@ -957,12 +957,14 @@ static int _disp_hyp_log_stats(size_t count) { static struct hypdbg_log_pos_t log_start = {0}; uint8_t *log_ptr; + uint32_t log_len; log_ptr = (uint8_t *)((unsigned char *)tzdbg.hyp_diag_buf + tzdbg.hyp_diag_buf->ring_off); + log_len = tzdbg.hyp_debug_rw_buf_size - tzdbg.hyp_diag_buf->ring_off; return __disp_hyp_log_stats(log_ptr, &log_start, - tzdbg.hyp_debug_rw_buf_size, count, TZDBG_HYP_LOG); + log_len, count, TZDBG_HYP_LOG); } static int _disp_qsee_log_stats(size_t count)