- /* Maybe the current pointer for this context is already the
- * right one? */
- r = mmap_cache_current(m, fd, context, offset, size, ret);
- if (r != 0)
- return r;
-
- /* Hmm, drop the reference to the current one, since it wasn't
- * good enough */
- mmap_cache_context_unset(m, context);
-
- /* OK, let's find the chain for this FD */
- r = mmap_cache_get_fd_index(m, fd, &fd_index);
- if (r < 0)
- return r;
-
- /* And let's look through the available mmaps */
- r = mmap_cache_find(m, fd, fd_index, context, offset, size, ret);
- if (r != 0)
- return r;
+ if (st) {
+ /* Memory maps that are larger then the files
+ underneath have undefined behavior. Hence, clamp
+ things to the file size if we know it */