Messages in this thread | | | Date | Fri, 04 Sep 1998 11:24:41 -0400 | From | Bill Hawes <> | Subject | Re: error in msync(2) or am I missing something? |
| |
Tigran Aivazian wrote: > In the msync(2) (source mm/filemap.c/sys_msync()) function there is a piece of > code: > > len = (len + ~PAGE_MASK) & PAGE_MASK; > end = start + len; > if (end < start) > goto out; > if (flags & ~(MS_ASYNC | MS_INVALIDATE | MS_SYNC)) > goto out; > error = 0; > if (end == start) > goto out; > > Now, len is size_t (unsigned int) so it can hardly ever become negative. So, > can't one simply rewrite the code as: > > if (flags & ~(MS_ASYNC | MS_INVALIDATE | MS_SYNC)) > goto out; > error = 0; > if (!len) > goto out;
The test for end < start is meant to catch wrap-around.
Regards, Bill
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/faq.html
| |