drm/exynos/gsc: Fix to check memory address and size separately 27/165627/1 accepted/tizen/unified/20180105.065533 submit/tizen/20180104.063507
authorHoegeun Kwon <hoegeun.kwon@samsung.com>
Tue, 2 Jan 2018 08:31:39 +0000 (17:31 +0900)
committerHoegeun Kwon <hoegeun.kwon@samsung.com>
Wed, 3 Jan 2018 02:20:18 +0000 (11:20 +0900)
If there is no Y, CB or CR address, memory size is not checked.
Checking the address and size of the memory should be checked
separately.

Change-Id: I196090b0b390fb4474c56bdf6ba6b6cb9c450f5c
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
drivers/gpu/drm/exynos/exynos_drm_gsc.c

index f759480..afbb3f1 100644 (file)
@@ -531,11 +531,11 @@ static int gsc_set_planar_addr(struct drm_exynos_ipp_buf_info *buf_info,
        case DRM_FORMAT_NV61:
                ofs[0] = sz->hsize * sz->vsize;
                ofs[1] = ofs[0] >> 1;
-               if (*base[0] && *base[1]) {
-                       if (size[0] + size[1] < ofs[0] + ofs[1])
-                               goto err_info;
+               if (size[0] + size[1] < ofs[0] + ofs[1])
+                       goto err_info;
+
+               if (*base[0] && *base[1])
                        bypass = true;
-               }
                break;
        case DRM_FORMAT_YUV410:
        case DRM_FORMAT_YVU410:
@@ -549,19 +549,18 @@ static int gsc_set_planar_addr(struct drm_exynos_ipp_buf_info *buf_info,
        case DRM_FORMAT_YVU444:
                ofs[0] = sz->hsize * sz->vsize;
                ofs[1] = ofs[2] = ofs[0] >> 2;
-               if (*base[0] && *base[1] && *base[2]) {
-                       if (size[0]+size[1]+size[2] < ofs[0]+ofs[1]+ofs[2])
-                               goto err_info;
+               if (size[0]+size[1]+size[2] < ofs[0]+ofs[1]+ofs[2])
+                       goto err_info;
+
+               if (*base[0] && *base[1] && *base[2])
                        bypass = true;
-               }
        break;
        case DRM_FORMAT_ARGB8888:
        case DRM_FORMAT_XRGB8888:
                ofs[0] = sz->hsize * sz->vsize << 2;
-               if (*base[0]) {
-                       if (size[0] < ofs[0])
-                               goto err_info;
-               }
+               if (size[0] < ofs[0])
+                       goto err_info;
+
                bypass = true;
                break;
        default: