lkml.org 
[lkml]   [2010]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/7] mmc: at91_mci: fix pointer errors
    On Fri, Feb 26, 2010 at 07:39:29PM +0100, Nicolas Ferre wrote:
    > From: Wolfgang Muees <wolfgang.mues@auerswald.de>
    >
    > Fixes two pointer errors, one which leads to memory overwrites if used with
    > large chunks of data.
    >
    > Signed-off-by: Wolfgang Muees <wolfgang.mues@auerswald.de>
    > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
    > ---
    > drivers/mmc/host/at91_mci.c | 8 +++++---
    > 1 files changed, 5 insertions(+), 3 deletions(-)
    >
    > diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
    > index 63924e0..6835104 100644
    > --- a/drivers/mmc/host/at91_mci.c
    > +++ b/drivers/mmc/host/at91_mci.c
    > @@ -227,11 +227,13 @@ static inline void at91_mci_sg_to_dma(struct at91mci_host *host, struct mmc_data
    > for (index = 0; index < (amount / 4); index++)
    > *dmabuf++ = swab32(sgbuffer[index]);
    > } else {
    > - memcpy(dmabuf, sgbuffer, amount);
    > - dmabuf += amount;
    > + char *tmpv = (char *)dmabuf;
    > + memcpy(tmpv, sgbuffer, amount);
    > + tmpv += amount;
    > + dmabuf = (unsigned *)tmpv;
    > }
    >
    > - kunmap_atomic(sgbuffer, KM_BIO_SRC_IRQ);
    > + kunmap_atomic(((void *)sgbuffer)-sg->offset, KM_BIO_SRC_IRQ);

    Please put spaces around the minus sign.

    kunmap_atomic(((void *)sgbuffer) - sg->offset, KM_BIO_SRC_IRQ);

    regards,
    dan carpenter

    >
    > if (size == 0)
    > break;
    > --
    > 1.5.6.5
    >
    > --
    > 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: 2010-02-26 21:31    [W:4.239 / U:0.092 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site