From: Markus Elfring <[email protected]>
Date: Mon, 13 Jul 2026 12:12:52 +0200

The address of a data structure member was determined before
a corresponding null pointer check in the implementation of
the function “ics5342_init”.

Thus avoid the risk for undefined behaviour by moving the assignment
for the variable “info” behind a condition check.

This issue was detected by using the Coccinelle software.

Fixes: ede481f6dad47d40b7e561cfbc6c04286a9faf1a ("fbdev: arkfb: Cast 
ics5342_init() allocation type")
Cc: [email protected]
Signed-off-by: Markus Elfring <[email protected]>
---
 drivers/video/fbdev/arkfb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/arkfb.c b/drivers/video/fbdev/arkfb.c
index 195dbf4a5142..9658f407b79a 100644
--- a/drivers/video/fbdev/arkfb.c
+++ b/drivers/video/fbdev/arkfb.c
@@ -432,11 +432,12 @@ static struct dac_ops ics5342_ops = {
 static struct dac_info * ics5342_init(dac_read_regs_t drr, dac_write_regs_t 
dwr, void *data)
 {
        struct ics5342_info *ics_info = kzalloc_obj(struct ics5342_info);
-       struct dac_info *info = &ics_info->dac;
+       struct dac_info *info;
 
        if (!ics_info)
                return NULL;
 
+       info = &ics_info->dac;
        info->dacops = &ics5342_ops;
        info->dac_read_regs = drr;
        info->dac_write_regs = dwr;
-- 
2.55.0

Reply via email to