Skip to content

Commit

Permalink
mmc: at91_mci: fix pointer errors
Browse files Browse the repository at this point in the history
Fixes two pointer errors, one which leads to memory overwrites if used
with large chunks of data.

Signed-off-by: Wolfgang Muees <[email protected]>
Signed-off-by: Nicolas Ferre <[email protected]>
Cc: Andrew Victor <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Wolfgang Muees authored and torvalds committed Mar 6, 2010
1 parent dc2ed55 commit 0b3520f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/mmc/host/at91_mci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

if (size == 0)
break;
Expand Down

0 comments on commit 0b3520f

Please sign in to comment.