Date: Thu, 13 Apr 2023 22:08:42 +0200 The address of a data structure member was determined before a corresponding null pointer check in the implementation of the function “atomisp_cp_general_isp_parameters”. Thus avoid the risk for undefined behaviour by moving the assignment for the variable “cur_config” behind the null pointer check. This issue was detected by using the Coccinelle software. Fixes: ad85094b293e40e7a2f831b0311a389d952ebd5e ("Revert 'media: staging: atomisp: Remove driver'") Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> --- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index 47f18ac5e40e..733a239b5d8a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -2723,11 +2723,13 @@ int atomisp_cp_general_isp_parameters(struct atomisp_sub_device *asd, struct atomisp_css_params *css_param, bool from_user) { - struct atomisp_parameters *cur_config = &css_param->update_flag; + struct atomisp_parameters *cur_config; if (!arg || !asd || !css_param) return -EINVAL; + cur_config = &css_param->update_flag; + if (arg->wb_config && (from_user || !cur_config->wb_config)) { if (copy_from_compatible(&css_param->wb_config, arg->wb_config, sizeof(struct ia_css_wb_config), -- 2.40.0