lkml.org 
[lkml]   [2005]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[patch 2/6] uml: critical change memcpy to memmove [critical, for 2.6.12]
    From
    Date

    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>
    ---

    linux-2.6.12-paolo/arch/um/kernel/irq_user.c | 10 ++++++++--
    1 files changed, 8 insertions(+), 2 deletions(-)

    diff -puN arch/um/kernel/irq_user.c~uml-critical-change-memcpy-to-memmove arch/um/kernel/irq_user.c
    --- linux-2.6.12/arch/um/kernel/irq_user.c~uml-critical-change-memcpy-to-memmove 2005-05-02 17:54:20.000000000 +0200
    +++ linux-2.6.12-paolo/arch/um/kernel/irq_user.c 2005-05-02 17:54:20.000000000 +0200
    @@ -236,9 +236,15 @@ static void free_irq_by_cb(int (*test)(s
    (*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;
    _
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/
    \
     
     \ /
      Last update: 2005-05-10 01:40    [W:0.033 / U:31.276 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site