[PATCH] USB: fix buffer size limiting in skeleton driver
authorOlav Kongas <ok@artecdesign.ee>
Thu, 22 Dec 2005 10:44:52 +0000 (12:44 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 4 Jan 2006 21:51:45 +0000 (13:51 -0800)
Fix buffer size limiting.

Signed-off-by: Olav Kongas <ok@artecdesign.ee>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/usb-skeleton.c

index 719d23a4ac51644fde1464131f20c8421dd9d291..b6652ef568309b5b9db98b9a95226008555799f0 100644 (file)
@@ -166,7 +166,7 @@ static ssize_t skel_write(struct file *file, const char *user_buffer, size_t cou
        int retval = 0;
        struct urb *urb = NULL;
        char *buf = NULL;
-       size_t writesize = max(count, MAX_TRANSFER);
+       size_t writesize = min(count, MAX_TRANSFER);
 
        dev = (struct usb_skel *)file->private_data;