public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.6 patch] drivers/usb/core/devices.c: small corrections
@ 2005-03-22 22:08 Adrian Bunk
  2005-03-24 22:44 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Adrian Bunk @ 2005-03-22 22:08 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb-devel, linux-kernel

total_written is used at places where it can't have any value different 
from 0.

This patch is partially based on findings of the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@stusta.de>

--- linux-2.6.12-rc1-mm1-full/drivers/usb/core/devices.c.old	2005-03-22 21:13:18.000000000 +0100
+++ linux-2.6.12-rc1-mm1-full/drivers/usb/core/devices.c	2005-03-22 21:15:02.000000000 +0100
@@ -460,7 +460,7 @@ static ssize_t usb_device_dump(char __us
 		return 0;
 	
 	if (level > MAX_TOPO_LEVEL)
-		return total_written;
+		return 0;
 	/* allocate 2^1 pages = 8K (on i386); should be more than enough for one device */
         if (!(pages_start = (char*) __get_free_pages(GFP_KERNEL,1)))
                 return -ENOMEM;
@@ -527,10 +527,7 @@ static ssize_t usb_device_dump(char __us
 			length = *nbytes;
 		if (copy_to_user(*buffer, pages_start + *skip_bytes, length)) {
 			free_pages((unsigned long)pages_start, 1);
-			
-			if (total_written == 0)
-				return -EFAULT;
-			return total_written;
+			return -EFAULT;
 		}
 		*nbytes -= length;
 		*file_offset += length;


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [2.6 patch] drivers/usb/core/devices.c: small corrections
  2005-03-22 22:08 [2.6 patch] drivers/usb/core/devices.c: small corrections Adrian Bunk
@ 2005-03-24 22:44 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2005-03-24 22:44 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: gregkh, linux-usb-devel, linux-kernel

On Tue, Mar 22, 2005 at 11:08:16PM +0100, Adrian Bunk wrote:
> total_written is used at places where it can't have any value different 
> from 0.
> 
> This patch is partially based on findings of the Coverity checker.
> 
> Signed-off-by: Adrian Bunk <bunk@stusta.de>

Applied, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-03-24 22:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-22 22:08 [2.6 patch] drivers/usb/core/devices.c: small corrections Adrian Bunk
2005-03-24 22:44 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox