]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - mm/fadvise.c
mm/slab.c: fix an infinite loop in leaks_show()
[mirror_ubuntu-bionic-kernel.git] / mm / fadvise.c
index 767887f5f3bfd79b493a731dbc467d96545f8494..3f5f68ad57080f6909e8fcc91a516d946da5d519 100644 (file)
@@ -71,8 +71,12 @@ SYSCALL_DEFINE4(fadvise64_64, int, fd, loff_t, offset, loff_t, len, int, advice)
                goto out;
        }
 
-       /* Careful about overflows. Len == 0 means "as much as possible" */
-       endbyte = offset + len;
+       /*
+        * Careful about overflows. Len == 0 means "as much as possible".  Use
+        * unsigned math because signed overflows are undefined and UBSan
+        * complains.
+        */
+       endbyte = (u64)offset + (u64)len;
        if (!len || endbyte < len)
                endbyte = -1;
        else