Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* [PATCH] fbdev: arkfb: Move a variable assignment behind a condition check in ics5342_init()
@ 2026-07-13 10:18 Markus Elfring
  0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2026-07-13 10:18 UTC (permalink / raw)
  To: linux-fbdev, dri-devel, Helge Deller, Kees Cook,
	Uwe Kleine-König
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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: stable@vger.kernel.org
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-13 10:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-13 10:18 [PATCH] fbdev: arkfb: Move a variable assignment behind a condition check in ics5342_init() Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox