lkml.org 
[lkml]   [2016]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] staging: vc04_services: Fix unportable cast in vchiq_copy_from_user
On Sun, Oct 23, 2016 at 10:29:18PM -0700, mzoran@crowfest.net wrote:
> From: Michael Zoran <mzoran@crowfest.net>
>
> Signed-off-by: Michael Zoran <mzoran@crowfest.net>
> ---
> drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
> index 32d12e6..98c6819 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
> @@ -219,7 +219,7 @@ remote_event_signal(REMOTE_EVENT_T *event)
> int
> vchiq_copy_from_user(void *dst, const void *src, int size)
> {
> - if ((uint32_t)src < TASK_SIZE) {
> + if ((unsigned long)src < TASK_SIZE) {
> return copy_from_user(dst, src, size);
> } else {
> memcpy(dst, src, size);

Ick, that's horrid.

And I can't take patches without a changelog text.

Please fix up the callers to do the right thing, this shouldn't be a
wrapper function at all, especially given the mess of a cast as Dan
points out. Just call the correct copy_from_user() call and handle the
correct error return value.

thanks,

greg k-h

\
 
 \ /
  Last update: 2016-10-24 15:24    [W:0.659 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site