mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-28 14:44:10 +08:00
mm/nommu.c: add additional check for vread() just like vwrite() has done
vwrite() checks for overflow. vread() should do the same thing. Since vwrite() checks the source buffer address, vread() should check the destination buffer address. Signed-off-by: Chen Gang <gang.chen@asianux.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Michel Lespinasse <walken@google.com> Cc: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
dacbde0963
commit
9bde916bc7
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user