public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] loop: don't increment p->offset with (size_t) -EINVAL
@ 2009-03-04 13:29 Roel Kluin
  2009-03-05  7:04 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-03-04 13:29 UTC (permalink / raw)
  To: Jens Axboe; +Cc: lkml, Andrew Morton

Upon a 'transfer error block' size is set to -EINVAL, but this becomes positive
since size is unsigned: p->offset still gets incremented.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index edbaac6..bf03455 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -392,8 +392,7 @@ lo_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
 	struct loop_device *lo = p->lo;
 	struct page *page = buf->page;
 	sector_t IV;
-	size_t size;
-	int ret;
+	int size, ret;
 
 	ret = buf->ops->confirm(pipe, buf);
 	if (unlikely(ret))

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

* Re: [PATCH] loop: don't increment p->offset with (size_t) -EINVAL
  2009-03-04 13:29 [PATCH] loop: don't increment p->offset with (size_t) -EINVAL Roel Kluin
@ 2009-03-05  7:04 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2009-03-05  7:04 UTC (permalink / raw)
  To: Roel Kluin; +Cc: lkml, Andrew Morton

On Wed, Mar 04 2009, Roel Kluin wrote:
> Upon a 'transfer error block' size is set to -EINVAL, but this becomes positive
> since size is unsigned: p->offset still gets incremented.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index edbaac6..bf03455 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -392,8 +392,7 @@ lo_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
>  	struct loop_device *lo = p->lo;
>  	struct page *page = buf->page;
>  	sector_t IV;
> -	size_t size;
> -	int ret;
> +	int size, ret;
>  
>  	ret = buf->ops->confirm(pipe, buf);
>  	if (unlikely(ret))

Good catch! Applied.

-- 
Jens Axboe


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

end of thread, other threads:[~2009-03-05  7:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-04 13:29 [PATCH] loop: don't increment p->offset with (size_t) -EINVAL Roel Kluin
2009-03-05  7:04 ` Jens Axboe

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