Commit 158aeefc authored by Joe Perches's avatar Joe Perches Committed by Mauro Carvalho Chehab

[media] atomisp: Add __printf validation and fix fallout

__printf validation adds format and argument validation.

Fix the various broken format/argument mismatches.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent f2c61f98
...@@ -265,7 +265,7 @@ ia_css_translate_dvs_statistics( ...@@ -265,7 +265,7 @@ ia_css_translate_dvs_statistics(
assert(isp_stats->hor_proj != NULL); assert(isp_stats->hor_proj != NULL);
assert(isp_stats->ver_proj != NULL); assert(isp_stats->ver_proj != NULL);
IA_CSS_ENTER("hproj=%p, vproj=%p, haddr=%x, vaddr=%x", IA_CSS_ENTER("hproj=%p, vproj=%p, haddr=%p, vaddr=%p",
host_stats->hor_proj, host_stats->ver_proj, host_stats->hor_proj, host_stats->ver_proj,
isp_stats->hor_proj, isp_stats->ver_proj); isp_stats->hor_proj, isp_stats->ver_proj);
......
...@@ -213,7 +213,7 @@ ia_css_translate_dvs2_statistics( ...@@ -213,7 +213,7 @@ ia_css_translate_dvs2_statistics(
"hor_coefs.even_real=%p, hor_coefs.even_imag=%p, " "hor_coefs.even_real=%p, hor_coefs.even_imag=%p, "
"ver_coefs.odd_real=%p, ver_coefs.odd_imag=%p, " "ver_coefs.odd_real=%p, ver_coefs.odd_imag=%p, "
"ver_coefs.even_real=%p, ver_coefs.even_imag=%p, " "ver_coefs.even_real=%p, ver_coefs.even_imag=%p, "
"haddr=%x, vaddr=%x", "haddr=%p, vaddr=%p",
host_stats->hor_prod.odd_real, host_stats->hor_prod.odd_imag, host_stats->hor_prod.odd_real, host_stats->hor_prod.odd_imag,
host_stats->hor_prod.even_real, host_stats->hor_prod.even_imag, host_stats->hor_prod.even_real, host_stats->hor_prod.even_imag,
host_stats->ver_prod.odd_real, host_stats->ver_prod.odd_imag, host_stats->ver_prod.odd_real, host_stats->ver_prod.odd_imag,
......
...@@ -55,7 +55,7 @@ ia_css_tnr_dump( ...@@ -55,7 +55,7 @@ ia_css_tnr_dump(
"tnr_coef", tnr->coef); "tnr_coef", tnr->coef);
ia_css_debug_dtrace(level, "\t%-32s = %d\n", ia_css_debug_dtrace(level, "\t%-32s = %d\n",
"tnr_threshold_Y", tnr->threshold_Y); "tnr_threshold_Y", tnr->threshold_Y);
ia_css_debug_dtrace(level, "\t%-32s = %d\n" ia_css_debug_dtrace(level, "\t%-32s = %d\n",
"tnr_threshold_C", tnr->threshold_C); "tnr_threshold_C", tnr->threshold_C);
} }
......
...@@ -137,6 +137,7 @@ ia_css_debug_vdtrace(unsigned int level, const char *fmt, va_list args) ...@@ -137,6 +137,7 @@ ia_css_debug_vdtrace(unsigned int level, const char *fmt, va_list args)
sh_css_vprint(fmt, args); sh_css_vprint(fmt, args);
} }
__printf(2, 3)
extern void ia_css_debug_dtrace(unsigned int level, const char *fmt, ...); extern void ia_css_debug_dtrace(unsigned int level, const char *fmt, ...);
/*! @brief Dump sp thread's stack contents /*! @brief Dump sp thread's stack contents
......
...@@ -3148,7 +3148,7 @@ ia_css_debug_dump_pipe_config( ...@@ -3148,7 +3148,7 @@ ia_css_debug_dump_pipe_config(
ia_css_debug_dump_frame_info(&config->vf_output_info[i], ia_css_debug_dump_frame_info(&config->vf_output_info[i],
"vf_output_info"); "vf_output_info");
} }
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "acc_extension: 0x%x\n", ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "acc_extension: %p\n",
config->acc_extension); config->acc_extension);
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "num_acc_stages: %d\n", ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "num_acc_stages: %d\n",
config->num_acc_stages); config->num_acc_stages);
...@@ -3179,7 +3179,7 @@ ia_css_debug_dump_stream_config_source( ...@@ -3179,7 +3179,7 @@ ia_css_debug_dump_stream_config_source(
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "timeout: %d\n", ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "timeout: %d\n",
config->source.port.timeout); config->source.port.timeout);
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "compression: %d\n", ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "compression: %d\n",
config->source.port.compression); config->source.port.compression.type);
break; break;
case IA_CSS_INPUT_MODE_TPG: case IA_CSS_INPUT_MODE_TPG:
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "source.tpg\n"); ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "source.tpg\n");
......
...@@ -2003,7 +2003,7 @@ ia_css_enable_isys_event_queue(bool enable) ...@@ -2003,7 +2003,7 @@ ia_css_enable_isys_event_queue(bool enable)
void *sh_css_malloc(size_t size) void *sh_css_malloc(size_t size)
{ {
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "sh_css_malloc() enter: size=%d\n",size); ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "sh_css_malloc() enter: size=%zu\n",size);
/* FIXME: This first test can probably go away */ /* FIXME: This first test can probably go away */
if (size == 0) if (size == 0)
return NULL; return NULL;
...@@ -2016,7 +2016,7 @@ void *sh_css_calloc(size_t N, size_t size) ...@@ -2016,7 +2016,7 @@ void *sh_css_calloc(size_t N, size_t size)
{ {
void *p; void *p;
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "sh_css_calloc() enter: N=%d, size=%d\n",N,size); ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "sh_css_calloc() enter: N=%zu, size=%zu\n",N,size);
/* FIXME: this test can probably go away */ /* FIXME: this test can probably go away */
if (size > 0) { if (size > 0) {
...@@ -2059,7 +2059,8 @@ map_sp_threads(struct ia_css_stream *stream, bool map) ...@@ -2059,7 +2059,8 @@ map_sp_threads(struct ia_css_stream *stream, bool map)
enum ia_css_pipe_id pipe_id; enum ia_css_pipe_id pipe_id;
assert(stream != NULL); assert(stream != NULL);
IA_CSS_ENTER_PRIVATE("stream = %p, map = %p", stream, map); IA_CSS_ENTER_PRIVATE("stream = %p, map = %s",
stream, map ? "true" : "false");
if (stream == NULL) { if (stream == NULL) {
IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_INVALID_ARGUMENTS); IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_INVALID_ARGUMENTS);
...@@ -2766,7 +2767,7 @@ enum ia_css_err ia_css_irq_translate( ...@@ -2766,7 +2767,7 @@ enum ia_css_err ia_css_irq_translate(
*irq_infos = infos; *irq_infos = infos;
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_irq_translate() " ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_irq_translate() "
"leave: irq_infos=%p\n", infos); "leave: irq_infos=%u\n", infos);
return IA_CSS_SUCCESS; return IA_CSS_SUCCESS;
} }
...@@ -4514,7 +4515,7 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe, ...@@ -4514,7 +4515,7 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,
#else #else
if (hmm_buffer_record) { if (hmm_buffer_record) {
#endif #endif
IA_CSS_LOG("send vbuf=0x%x", h_vbuf); IA_CSS_LOG("send vbuf=%p", h_vbuf);
} else { } else {
return_err = IA_CSS_ERR_INTERNAL_ERROR; return_err = IA_CSS_ERR_INTERNAL_ERROR;
IA_CSS_ERROR("hmm_buffer_record[]: no available slots\n"); IA_CSS_ERROR("hmm_buffer_record[]: no available slots\n");
...@@ -4624,7 +4625,7 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe, ...@@ -4624,7 +4625,7 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe,
ia_css_rmgr_rel_vbuf(hmm_buffer_pool, &hmm_buffer_record->h_vbuf); ia_css_rmgr_rel_vbuf(hmm_buffer_pool, &hmm_buffer_record->h_vbuf);
sh_css_hmm_buffer_record_reset(hmm_buffer_record); sh_css_hmm_buffer_record_reset(hmm_buffer_record);
} else { } else {
IA_CSS_ERROR("hmm_buffer_record not found (0x%p) buf_type(%d)", IA_CSS_ERROR("hmm_buffer_record not found (0x%u) buf_type(%d)",
ddr_buffer_addr, buf_type); ddr_buffer_addr, buf_type);
IA_CSS_LEAVE_ERR(IA_CSS_ERR_INTERNAL_ERROR); IA_CSS_LEAVE_ERR(IA_CSS_ERR_INTERNAL_ERROR);
return IA_CSS_ERR_INTERNAL_ERROR; return IA_CSS_ERR_INTERNAL_ERROR;
...@@ -4640,8 +4641,8 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe, ...@@ -4640,8 +4641,8 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe,
if ((ddr_buffer.kernel_ptr == 0) || if ((ddr_buffer.kernel_ptr == 0) ||
(kernel_ptr != HOST_ADDRESS(ddr_buffer.kernel_ptr))) { (kernel_ptr != HOST_ADDRESS(ddr_buffer.kernel_ptr))) {
IA_CSS_ERROR("kernel_ptr invalid"); IA_CSS_ERROR("kernel_ptr invalid");
IA_CSS_ERROR("expected: (0x%p)", kernel_ptr); IA_CSS_ERROR("expected: (0x%llx)", (u64)kernel_ptr);
IA_CSS_ERROR("actual: (0x%p)", HOST_ADDRESS(ddr_buffer.kernel_ptr)); IA_CSS_ERROR("actual: (0x%llx)", (u64)HOST_ADDRESS(ddr_buffer.kernel_ptr));
IA_CSS_ERROR("buf_type: %d\n", buf_type); IA_CSS_ERROR("buf_type: %d\n", buf_type);
IA_CSS_LEAVE_ERR(IA_CSS_ERR_INTERNAL_ERROR); IA_CSS_LEAVE_ERR(IA_CSS_ERR_INTERNAL_ERROR);
return IA_CSS_ERR_INTERNAL_ERROR; return IA_CSS_ERR_INTERNAL_ERROR;
...@@ -6621,7 +6622,7 @@ allocate_delay_frames(struct ia_css_pipe *pipe) ...@@ -6621,7 +6622,7 @@ allocate_delay_frames(struct ia_css_pipe *pipe)
IA_CSS_ENTER_PRIVATE(""); IA_CSS_ENTER_PRIVATE("");
if (pipe == NULL) { if (pipe == NULL) {
IA_CSS_ERROR("Invalid args - pipe %x", pipe); IA_CSS_ERROR("Invalid args - pipe %p", pipe);
return IA_CSS_ERR_INVALID_ARGUMENTS; return IA_CSS_ERR_INVALID_ARGUMENTS;
} }
......
...@@ -681,7 +681,7 @@ send_mipi_frames(struct ia_css_pipe *pipe) ...@@ -681,7 +681,7 @@ send_mipi_frames(struct ia_css_pipe *pipe)
unsigned int port = 0; unsigned int port = 0;
#endif #endif
IA_CSS_ENTER_PRIVATE("pipe=%d", pipe); IA_CSS_ENTER_PRIVATE("pipe=%p", pipe);
assert(pipe != NULL); assert(pipe != NULL);
assert(pipe->stream != NULL); assert(pipe->stream != NULL);
......
...@@ -3375,7 +3375,7 @@ enum ia_css_err ia_css_pipe_set_bci_scaler_lut(struct ia_css_pipe *pipe, ...@@ -3375,7 +3375,7 @@ enum ia_css_err ia_css_pipe_set_bci_scaler_lut(struct ia_css_pipe *pipe,
#endif #endif
if (pipe->scaler_pp_lut == mmgr_NULL) { if (pipe->scaler_pp_lut == mmgr_NULL) {
#ifndef ISP2401 #ifndef ISP2401
IA_CSS_LEAVE("lut(%p) err=%d", pipe->scaler_pp_lut, err); IA_CSS_LEAVE("lut(%u) err=%d", pipe->scaler_pp_lut, err);
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
#else #else
ia_css_debug_dtrace(IA_CSS_DEBUG_ERROR, ia_css_debug_dtrace(IA_CSS_DEBUG_ERROR,
...@@ -3397,7 +3397,7 @@ enum ia_css_err ia_css_pipe_set_bci_scaler_lut(struct ia_css_pipe *pipe, ...@@ -3397,7 +3397,7 @@ enum ia_css_err ia_css_pipe_set_bci_scaler_lut(struct ia_css_pipe *pipe,
#endif #endif
} }
IA_CSS_LEAVE("lut(%p) err=%d", pipe->scaler_pp_lut, err); IA_CSS_LEAVE("lut(%u) err=%d", pipe->scaler_pp_lut, err);
return err; return err;
} }
...@@ -3437,7 +3437,7 @@ enum ia_css_err sh_css_params_map_and_store_default_gdc_lut(void) ...@@ -3437,7 +3437,7 @@ enum ia_css_err sh_css_params_map_and_store_default_gdc_lut(void)
mmgr_store(default_gdc_lut, (int *)interleaved_lut_temp, mmgr_store(default_gdc_lut, (int *)interleaved_lut_temp,
sizeof(zoom_table)); sizeof(zoom_table));
IA_CSS_LEAVE_PRIVATE("lut(%p) err=%d", default_gdc_lut, err); IA_CSS_LEAVE_PRIVATE("lut(%u) err=%d", default_gdc_lut, err);
return err; return err;
} }
...@@ -3859,7 +3859,7 @@ sh_css_param_update_isp_params(struct ia_css_pipe *curr_pipe, ...@@ -3859,7 +3859,7 @@ sh_css_param_update_isp_params(struct ia_css_pipe *curr_pipe,
/* When API change is implemented making good distinction between /* When API change is implemented making good distinction between
* stream config and pipe config this skipping code can be moved out of the #ifdef */ * stream config and pipe config this skipping code can be moved out of the #ifdef */
if (pipe_in && (pipe != pipe_in)) { if (pipe_in && (pipe != pipe_in)) {
IA_CSS_LOG("skipping pipe %x", pipe); IA_CSS_LOG("skipping pipe %p", pipe);
continue; continue;
} }
...@@ -4590,7 +4590,7 @@ free_ia_css_isp_parameter_set_info( ...@@ -4590,7 +4590,7 @@ free_ia_css_isp_parameter_set_info(
unsigned int i; unsigned int i;
hrt_vaddress *addrs = (hrt_vaddress *)&isp_params_info.mem_map; hrt_vaddress *addrs = (hrt_vaddress *)&isp_params_info.mem_map;
IA_CSS_ENTER_PRIVATE("ptr = %p", ptr); IA_CSS_ENTER_PRIVATE("ptr = %u", ptr);
/* sanity check - ptr must be valid */ /* sanity check - ptr must be valid */
if (!ia_css_refcount_is_valid(ptr)) { if (!ia_css_refcount_is_valid(ptr)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment