From 32eea8bf2866932d51a258bd51860a3676b53214 Mon Sep 17 00:00:00 2001 From: Deepak Kumar Date: Mon, 16 Dec 2019 22:24:08 +0530 Subject: [PATCH] msm: kgsl: Don't error out if dst size is not equal to src in copy_prop Update copy_prop to allow copy to a destination buffer of size greater than or less the source buffer size. This is needed to correctly pass gaming bin fuse value to user mode. Change-Id: I1b651c79b9286c1259fbace815d58892462a7931 Signed-off-by: Deepak Kumar --- drivers/gpu/msm/adreno.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/msm/adreno.c b/drivers/gpu/msm/adreno.c index d5b56a712e1e..8900ac4b3133 100644 --- a/drivers/gpu/msm/adreno.c +++ b/drivers/gpu/msm/adreno.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2002,2007-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2002,2007-2020, The Linux Foundation. All rights reserved. */ #include #include @@ -2376,10 +2376,8 @@ int adreno_reset(struct kgsl_device *device, int fault) static int copy_prop(struct kgsl_device_getproperty *param, void *src, size_t size) { - if (param->sizebytes != size) - return -EINVAL; - - if (copy_to_user(param->value, src, param->sizebytes)) + if (copy_to_user(param->value, src, + min_t(u32, size, param->sizebytes))) return -EFAULT; return 0;