[PATCH] 2.5.27 read_write

From: Marcin Dalecki (dalecki@evision.ag)
Date: Mon Jul 22 2002 - 09:08:30 EST


- 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;
         }
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Jul 23 2002 - 22:00:38 EST