From 8c994bbe150023a5fdf7620850ff51330c5f6026 Mon Sep 17 00:00:00 2001 From: "Isaac J. Manjarres" Date: Thu, 19 Aug 2021 11:50:14 -0700 Subject: [PATCH] soc: qcom: secure_buffer: Fix types and accessors when working with __le64 When the kernel is compiled with the sparse static analysis tool enabled, the following warnings are emitted: drivers/soc/qcom//trace_secure_buffer.h:53:1: warning: incorrect type in assignment (different base types) drivers/soc/qcom//trace_secure_buffer.h:53:1: warning: incorrect type in assignment (different base types) drivers/soc/qcom//trace_secure_buffer.h:53:1: warning: invalid assignment: += Fix this by converting the type of the addrs variable from phys_addr_t to u64, since the value we read into it is of type__le64 will always be 64 bits, while phys_addr_t may not be. Also, use the correct accessors when accessing variables of type __le64. Change-Id: Ia7e2394f2dc501dbf80f9035e0177555449dcfd8 Signed-off-by: Isaac J. Manjarres --- drivers/soc/qcom/trace_secure_buffer.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/soc/qcom/trace_secure_buffer.h b/drivers/soc/qcom/trace_secure_buffer.h index 2fef8079fd56..655ffde55862 100644 --- a/drivers/soc/qcom/trace_secure_buffer.h +++ b/drivers/soc/qcom/trace_secure_buffer.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2019, 2021 The Linux Foundation. All rights reserved. */ #undef TRACE_SYSTEM @@ -59,29 +59,29 @@ TRACE_EVENT(hyp_assign_batch_start, TP_STRUCT__entry( __field(int, info_nelems) __field(u64, batch_size) - __dynamic_array(phys_addr_t, addrs, info_nelems) + __dynamic_array(u64, addrs, info_nelems) __dynamic_array(u64, sizes, info_nelems) ), TP_fast_assign( unsigned int i; - phys_addr_t *addr_arr_ptr = __get_dynamic_array(addrs); + u64 *addr_arr_ptr = __get_dynamic_array(addrs); u64 *sizes_arr_ptr = __get_dynamic_array(sizes); __entry->info_nelems = info_nelems; __entry->batch_size = 0; for (i = 0; i < info_nelems; i++) { - addr_arr_ptr[i] = info[i].mem_addr; - sizes_arr_ptr[i] = info[i].mem_size; - __entry->batch_size += info[i].mem_size; + addr_arr_ptr[i] = le64_to_cpu(info[i].mem_addr); + sizes_arr_ptr[i] = le64_to_cpu(info[i].mem_size); + __entry->batch_size += le64_to_cpu(info[i].mem_size); } ), TP_printk("num entries: %d batch size: %llu phys addrs: %s sizes: %s", __entry->info_nelems, __entry->batch_size, __print_array(__get_dynamic_array(addrs), - __entry->info_nelems, sizeof(phys_addr_t)), + __entry->info_nelems, sizeof(u64)), __print_array(__get_dynamic_array(sizes), __entry->info_nelems, sizeof(u64)) )