Merge "msm: kgsl: Don't error out if dst size is not equal to src in copy_prop"

This commit is contained in:
qctecmdr 2020-01-08 07:31:54 -08:00 • committed by Gerrit - the friendly Code Review server
commit 2d6312a106

View file

@ -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 <linux/delay.h>
#include <linux/firmware.h>
@ -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;