From 84542d844894aab29f816d4e89982523e8cb50ec Mon Sep 17 00:00:00 2001 From: "hyesoo.yu" Date: Thu, 9 Nov 2017 15:43:05 +0900 Subject: [PATCH] [COMMON] g2d: fix out-of-bound of fence name Fix global-out-of-bounds to copy the fence name Change-Id: I388a2f007868e98612f62f23bc8bc0a632a8883c Signed-off-by: hyesoo.yu --- drivers/gpu/exynos/g2d/g2d_fence.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/exynos/g2d/g2d_fence.c b/drivers/gpu/exynos/g2d/g2d_fence.c index fd080451e770..eda8056daa7a 100644 --- a/drivers/gpu/exynos/g2d/g2d_fence.c +++ b/drivers/gpu/exynos/g2d/g2d_fence.c @@ -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"); -- 2.20.1