Patchwork spufs: Fix test in spufs_switch_log_read()

login
register
mail settings
Submitter roel kluin
Date Oct. 12, 2009, 1:12 p.m.
Message ID <4AD32B3F.9060804@gmail.com>
Download mbox | patch
Permalink /patch/35759/
State Changes Requested
Headers show

Comments

roel kluin - Oct. 12, 2009, 1:12 p.m.
size_t len cannot be less than 0.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
Or can this test be removed?
Jeremy Kerr - Oct. 13, 2009, 12:49 a.m.
Roel,

> Or can this test be removed?

I'd prefer just to remove the test.

Cheers,


Jeremy
Arnd Bergmann - Oct. 13, 2009, 1:31 p.m.
On Tuesday 13 October 2009, Jeremy Kerr wrote:
> > Or can this test be removed?
> 
> I'd prefer just to remove the test.

Yes, sounds good.

	Arnd <><

Patch

diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 884e8bc..d4f304f 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -2494,7 +2494,7 @@  static ssize_t spufs_switch_log_read(struct file *file, char __user *buf,
 	struct spu_context *ctx = SPUFS_I(inode)->i_ctx;
 	int error = 0, cnt = 0;
 
-	if (!buf || len < 0)
+	if (!buf || (ssize_t)len < 0)
 		return -EINVAL;
 
 	error = spu_acquire(ctx);