[COMMON] g2d: fix out-of-bound of fence name
authorhyesoo.yu <hyesoo.yu@samsung.com>
Thu, 9 Nov 2017 06:43:05 +0000 (15:43 +0900)
committerSeungchul Kim <sc377.kim@samsung.com>
Mon, 28 May 2018 05:27:54 +0000 (14:27 +0900)
Fix global-out-of-bounds to copy the fence name

Change-Id: I388a2f007868e98612f62f23bc8bc0a632a8883c
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
drivers/gpu/exynos/g2d/g2d_fence.c

index fd080451e77013e882ef4ac5610b64c036787adc..eda8056daa7a2cd545817a06fa9ef860bf6ef3d0 100644 (file)
@@ -38,9 +38,8 @@ void g2d_fence_timeout_handler(unsigned long arg)
        for (i = 0; i < task->num_source; i++) {
                fence = task->source[i].fence;
                if (fence) {
-                       memcpy(name, fence->ops->get_driver_name(fence),
+                       strlcpy(name, fence->ops->get_driver_name(fence),
                               sizeof(name));
-                       name[sizeof(name) - 1] = '\0';
                        dev_err(g2d_dev->dev, "%s:  SOURCE[%d]:  %s #%d (%s)\n",
                                __func__, i, name, fence->seqno,
                                dma_fence_is_signaled(fence) ?
@@ -50,8 +49,7 @@ void g2d_fence_timeout_handler(unsigned long arg)
 
        fence = task->target.fence;
        if (fence) {
-               memcpy(name, fence->ops->get_driver_name(fence), sizeof(name));
-               name[sizeof(name) - 1] = '\0';
+               strlcpy(name, fence->ops->get_driver_name(fence), sizeof(name));
                pr_err("%s:  TARGET:     %s #%d (%s)\n",
                        __func__, name, fence->seqno,
                        dma_fence_is_signaled(fence) ? "signaled" : "active");