mm/nommu.c: add additional check for vread() just like vwrite() has done
[deliverable/linux.git] / mm / nommu.c
index 298884dcd6e71e4723a203a82f1613cbfcec19ec..1898b2fe9da5eefdc3b33823a3cd23d2a401118f 100644 (file)
@@ -282,6 +282,10 @@ EXPORT_SYMBOL(vmalloc_to_pfn);
 
 long vread(char *buf, char *addr, unsigned long count)
 {
+       /* Don't allow overflow */
+       if ((unsigned long) buf + count < count)
+               count = -(unsigned long) buf;
+
        memcpy(buf, addr, count);
        return count;
 }
This page took 0.026104 seconds and 5 git commands to generate.