Re: [RFT 1/2] cdc-wdm: sanitize error returns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Oliver Neukum <oneukum@xxxxxxx> writes:

> From b32365d88d1ae2de4dfdbdaad8e20ce11c9f7154 Mon Sep 17 00:00:00 2001
> From: Oliver Neukum <oliver@xxxxxxxxxx>
> Date: Fri, 27 Apr 2012 14:23:54 +0200
> Subject: [PATCH 1/2] cdc-wdm: sanitize error returns
>
> wdm_flush() returns unsanitized USB error codes.
> They must be cleaned up to before being anded to user space
>
> Signed-off-by: Oliver Neukum <oneukum@xxxxxxx>
> ---
>  drivers/usb/class/cdc-wdm.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
> index 0bb2b32..0209b46 100644
> --- a/drivers/usb/class/cdc-wdm.c
> +++ b/drivers/usb/class/cdc-wdm.c
> @@ -534,7 +534,7 @@ static int wdm_flush(struct file *file, fl_owner_t id)
>  		dev_err(&desc->intf->dev, "Error in flush path: %d\n",
>  			desc->werr);
>  
> -	return desc->werr;
> +	return usb_translate_errors(desc->werr);
>  }
>  
>  static unsigned int wdm_poll(struct file *file, struct poll_table_struct *wait)

Right, so that's the problem with the 512 error returned to userspace...

But this gives me a build error (on 3.2 - didn't have time to check 3.4
right now.  please ignore if this is different there):

make[1]: Entering directory `/usr/src/linux-headers-3.2.0-2-amd64'
  CC [M]  /usr/local/src/git/linux/drivers/usb/class/cdc-wdm.o
/usr/local/src/git/linux/drivers/usb/class/cdc-wdm.c: In function ‘wdm_flush’:
/usr/local/src/git/linux/drivers/usb/class/cdc-wdm.c:537:2: error: implicit declaration of function ‘usb_translate_errors’ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make[4]: *** [/usr/local/src/git/linux/drivers/usb/class/cdc-wdm.o] Error 1
make[3]: *** [cdc-wdm.ko] Error 2
make[2]: *** [sub-make] Error 2
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.2.0-2-amd64'
make: *** [class] Error 2



Bjørn
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux