Skip to contentSkip to conversation

spufs: Fix test in spufs_switch_log_read()

PATCH In review Roel Kluin 3 participants 5 messages Oct 12, 2009 – Nov 24, 2009

Subsystems (3)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 spufs: Fix test in spufs_switch_log_read()

size_t len cannot be less than 0.

---
Or can this test be removed?

arch/powerpc/platforms/cell/spufs/file.c +1 -1
index 884e8bc..d4f304f 100644
@@ -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);
#1 lore raw

Roel,

Quoted 1 line

Or can this test be removed?

I'd prefer just to remove the test.

Cheers,

Jeremy

#2 lore raw
Quoted 3 lines · Jeremy Kerr
Quoted 1 line

Or can this test be removed?

I'd prefer just to remove the test.

Yes, sounds good.

	Arnd <><
author
#3 lore raw

size_t len cannot be less than 0.

---

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Or can this test be removed?

I'd prefer just to remove the test.

Yes, sounds good.

If you meant only the left-hand part, here you go:

arch/powerpc/platforms/cell/spufs/file.c +1 -1
index 884e8bc..64a4c2d 100644
@@ -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)
 		return -EINVAL;
 
 	error = spu_acquire(ctx);