[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <3f1e7aaa-501a-44f1-8122-28e9efa0a33c@web.de>
Date: Sun, 2 Mar 2025 19:02:12 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: kernel-janitors@...r.kernel.org, linux-fbdev@...r.kernel.org,
dri-devel@...ts.freedesktop.org, Antonino Daplas <adaplas@....net>,
Helge Deller <deller@....de>, Thomas Zimmermann <tzimmermann@...e.de>,
Uwe Kleine-König <u.kleine-koenig@...libre.com>,
Yihao Han <hanyihao@...o.com>
Cc: cocci@...ia.fr, LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH RESEND] video: au1100fb: Move a variable assignment behind a
null pointer check in au1100fb_setmode()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Thu, 13 Apr 2023 21:35:36 +0200
The address of a data structure member was determined before
a corresponding null pointer check in the implementation of
the function “au1100fb_setmode”.
Thus avoid the risk for undefined behaviour by moving the assignment
for the variable “info” behind the null pointer check.
This issue was detected by using the Coccinelle software.
Fixes: 3b495f2bb749 ("Au1100 FB driver uplift for 2.6.")
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/video/fbdev/au1100fb.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/au1100fb.c b/drivers/video/fbdev/au1100fb.c
index cb317398e71a..fcb47b350bc9 100644
--- a/drivers/video/fbdev/au1100fb.c
+++ b/drivers/video/fbdev/au1100fb.c
@@ -137,13 +137,15 @@ static int au1100fb_fb_blank(int blank_mode, struct fb_info *fbi)
*/
int au1100fb_setmode(struct au1100fb_device *fbdev)
{
- struct fb_info *info = &fbdev->info;
+ struct fb_info *info;
u32 words;
int index;
if (!fbdev)
return -EINVAL;
+ info = &fbdev->info;
+
/* Update var-dependent FB info */
if (panel_is_active(fbdev->panel) || panel_is_color(fbdev->panel)) {
if (info->var.bits_per_pixel <= 8) {
--
2.40.0
Powered by blists - more mailing lists