[PATCH] uml: change memcpy to memmove
Replace one memcpy() call with overlapping source and dest arguments with one call to memmove(), to avoid data corruption. Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
02048817a7
commit
8f332287bc
1 changed files with 8 additions and 2 deletions
|
@ -236,9 +236,15 @@ static void free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg)
|
|||
(*prev)->fd, pollfds[i].fd);
|
||||
goto out;
|
||||
}
|
||||
memcpy(&pollfds[i], &pollfds[i + 1],
|
||||
(pollfds_num - i - 1) * sizeof(pollfds[0]));
|
||||
|
||||
pollfds_num--;
|
||||
|
||||
/* This moves the *whole* array after pollfds[i] (though
|
||||
* it doesn't spot as such)! */
|
||||
|
||||
memmove(&pollfds[i], &pollfds[i + 1],
|
||||
(pollfds_num - i) * sizeof(pollfds[0]));
|
||||
|
||||
if(last_irq_ptr == &old_fd->next)
|
||||
last_irq_ptr = prev;
|
||||
*prev = (*prev)->next;
|
||||
|
|
Loading…
Reference in a new issue