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: 3b495f2bb749b828499135743b9ddec46e34fda8 ("Au1100 FB driver uplift for 
2.6.")
Signed-off-by: Markus Elfring <elfr...@users.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

Reply via email to