Linux Framebuffer Layer development
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
	"Helge Deller" <deller@gmx.de>, "Kees Cook" <kees@kernel.org>,
	"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH] fbdev: arkfb: Move a variable assignment behind a condition check in ics5342_init()
Date: Mon, 13 Jul 2026 12:18:10 +0200	[thread overview]
Message-ID: <36d0eba7-e78d-4a06-95bc-c97d9b91f8f0@web.de> (raw)

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


                 reply	other threads:[~2026-07-13 10:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=36d0eba7-e78d-4a06-95bc-c97d9b91f8f0@web.de \
    --to=markus.elfring@web.de \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kees@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=u.kleine-koenig@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox