Fix SVACE Issues 99/188199/1
authorKarthik Bhat <kv.bhat@samsung.com>
Fri, 31 Aug 2018 08:58:21 +0000 (14:28 +0530)
committerKarthik Bhat <kv.bhat@samsung.com>
Mon, 3 Sep 2018 04:14:07 +0000 (09:44 +0530)
Change-Id: I5acfbfef1a97a7785523b848fd7a5c3678a3261f
Signed-off-by: Karthik Bhat <kv.bhat@samsung.com>
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/vigs/vigs_fbdev.c
drivers/gpu/drm/vigs/vigs_mman.c
drivers/gpu/drm/vigs/vigs_output.c
drivers/video/fbdev/core/fb_cmdline.c

index 6f65f06..64da774 100644 (file)
@@ -819,12 +819,12 @@ static void drm_connector_get_cmdline_mode(struct drm_connector *connector)
        char *option = NULL;
 
        if (fb_get_options(connector->name, &option))
-               return;
+               goto out_err;
 
        if (!drm_mode_parse_command_line_for_connector(option,
                                                       connector,
                                                       mode))
-               return;
+               goto out_err;
 
        if (mode->force) {
                const char *s;
@@ -853,6 +853,9 @@ static void drm_connector_get_cmdline_mode(struct drm_connector *connector)
                      mode->rb ? " reduced blanking" : "",
                      mode->margins ? " with margins" : "",
                      mode->interlace ?  " interlaced" : "");
+       out_err:
+           if(option != NULL)
+             kfree(option);
 }
 
 /**
index 2f7803f..69ec82f 100644 (file)
@@ -403,7 +403,7 @@ static int vigs_fbdev_probe_once(struct drm_fb_helper *helper,
         goto fail4;
     }
 
-    strcpy(fbi->fix.id, "VIGS");
+    strncpy(fbi->fix.id, "VIGS", sizeof(fbi->fix.id));
 
     drm_fb_helper_fill_fix(fbi, vigs_fb->base.pitches[0], vigs_fb->base.depth);
     drm_fb_helper_fill_var(fbi, helper, vigs_fb->base.width, vigs_fb->base.height);
@@ -434,7 +434,7 @@ static int vigs_fbdev_probe_once(struct drm_fb_helper *helper,
      * TODO: Play around with xoffset/yoffset, make sure this code works.
      */
 
-    offset = fbi->var.xoffset * (vigs_fb->base.bits_per_pixel >> 3);
+    offset = (unsigned long)(fbi->var.xoffset) * (vigs_fb->base.bits_per_pixel >> 3);
     offset += fbi->var.yoffset * vigs_fb->base.pitches[0];
 
     /*
index 9440d44..38316c7 100644 (file)
@@ -440,7 +440,7 @@ int vigs_mman_create(resource_size_t vram_base,
         goto fail1;
     }
 
-    sprintf(vma_cache_name, "vigs_vma_cache%u", vigs_vma_cache_index++);
+    snprintf(vma_cache_name, 100, "vigs_vma_cache%u", vigs_vma_cache_index++);
 
     (*mman)->vma_cache = kmem_cache_create(vma_cache_name,
                                            sizeof(struct vigs_mman_vma) +
index b192208..47603cb 100644 (file)
@@ -112,6 +112,8 @@ static int vigs_connector_get_modes(struct drm_connector *connector)
             preferred_mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER;
             drm_mode_set_crtcinfo(preferred_mode, CRTC_INTERLACE_HALVE_V);
             drm_mode_probed_add(connector, preferred_mode);
+            if (option != NULL)
+              kfree(option);
             return 1;
         }
     }
index 39509cc..32ad2f3 100644 (file)
@@ -52,6 +52,7 @@ int fb_get_options(const char *name, char **option)
                            opt[name_len] == ':')
                                options = opt + name_len + 1;
                }
+               options = kstrdup(options, GFP_KERNEL);
        }
        /* No match, pass global option */
        if (!options && option && fb_mode_option)