提交 0b3520f2 编写于 作者: W Wolfgang Muees 提交者: 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: NWolfgang Muees <wolfgang.mues@auerswald.de>
Signed-off-by: NNicolas Ferre <nicolas.ferre@atmel.com>
Cc: Andrew Victor <avictor.za@gmail.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册