forked from luck/tmp_suning_uos_patched
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: Wolfgang Muees <wolfgang.mues@auerswald.de> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Andrew Victor <avictor.za@gmail.com> Cc: <linux-mmc@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
dc2ed55280
commit
0b3520f2df
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user