| Date | Mon, 22 Jul 2002 16:08:30 +0200 | From | Marcin Dalecki <> | Subject | [PATCH] 2.5.27 read_write |
| |
- This is making the read_write.c C.
- It is fixing completely confused wild casting to 32 bits.
- Actually adding a comment explaining the obscure code, which is relying on integer arithmetics overflow. diff -urN linux-2.5.27/fs/read_write.c linux/fs/read_write.c --- linux-2.5.27/fs/read_write.c 2002-07-22 13:08:04.000000000 +0200 +++ linux/fs/read_write.c 2002-07-22 13:44:04.000000000 +0200 @@ -307,11 +307,11 @@ ret = -EINVAL; for (i = 0 ; i < count ; i++) { size_t tmp = tot_len; - int len = iov[i].iov_len; - if (len < 0) - goto out; - (u32)tot_len += len; - if (tot_len < tmp || tot_len < (u32)len) + size_t len = iov[i].iov_len; + + tot_len += len; + /* check for overflows */ + if (tot_len < tmp || tot_len < len) goto out; } |