From d71700364dfd6a67404af4ac9f11a9fe17194253 Mon Sep 17 00:00:00 2001 From: Anirudh Raghavendra Date: Fri, 5 Jun 2020 16:48:26 -0700 Subject: [PATCH] msm:adsprpc: Fix 32 bit error in capability API Fixed 32 bit error in capability API which was causing a failure in async tests. Also fixed returned errno value. Change-Id: I7aa5514bd9e755c512c371645a2b927943aca943 Signed-off-by: Anirudh Raghavendra --- drivers/char/adsprpc.c | 2 +- drivers/char/adsprpc_compat.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c index e8918f218293..376057e4cc6c 100644 --- a/drivers/char/adsprpc.c +++ b/drivers/char/adsprpc.c @@ -3591,7 +3591,7 @@ static int fastrpc_get_info_from_kernel( * kernel */ if (cap->attribute_ID >= FASTRPC_MAX_ATTRIBUTES) { - err = EOVERFLOW; + err = -EOVERFLOW; cap->capability = 0; goto bail; } diff --git a/drivers/char/adsprpc_compat.c b/drivers/char/adsprpc_compat.c index df4b792b345e..468119987c87 100644 --- a/drivers/char/adsprpc_compat.c +++ b/drivers/char/adsprpc_compat.c @@ -743,7 +743,7 @@ static int compat_fastrpc_get_dsp_info(struct file *filp, unsigned long arg) { struct compat_fastrpc_ioctl_capability __user *info32; - struct fastrpc_ioctl_capability *info; + struct fastrpc_ioctl_capability __user *info; compat_uint_t u; long ret; int err = 0; @@ -756,6 +756,10 @@ static int compat_fastrpc_get_dsp_info(struct file *filp, err = get_user(u, &info32->domain); err |= put_user(u, &info->domain); + + err = get_user(u, &info32->attribute_ID); + err |= put_user(u, &info->attribute_ID); + if (err) return err;