Commit 0b3520f2 authored by Wolfgang Muees's avatar Wolfgang Muees Committed by Linus Torvalds

mmc: at91_mci: fix pointer errors

Fixes two pointer errors, one which leads to memory overwrites if used
with large chunks of data.
Signed-off-by: default avatarWolfgang Muees <wolfgang.mues@auerswald.de>
Signed-off-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
Cc: Andrew Victor <avictor.za@gmail.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent dc2ed552
...@@ -227,11 +227,13 @@ static inline void at91_mci_sg_to_dma(struct at91mci_host *host, struct mmc_data ...@@ -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++) for (index = 0; index < (amount / 4); index++)
*dmabuf++ = swab32(sgbuffer[index]); *dmabuf++ = swab32(sgbuffer[index]);
} else { } else {
memcpy(dmabuf, sgbuffer, amount); char *tmpv = (char *)dmabuf;
dmabuf += amount; 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) if (size == 0)
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment