diff options
author | Wolfgang Muees <wolfgang.mues@auerswald.de> | 2010-03-05 16:43:38 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-06 14:26:37 -0500 |
commit | 0b3520f2df8e4e5dad6a7b2743d037bf06c22024 (patch) | |
tree | c3cb1b36e5a4e05f94be6ac9c92da4bdcf4b5734 /drivers/mmc | |
parent | dc2ed552804f3a2ae41c0ffe4bc09879ec8f7396 (diff) |
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>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | 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 63924e0c7ea9..4e1b2e6288da 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 | |||
227 | for (index = 0; index < (amount / 4); index++) | 227 | for (index = 0; index < (amount / 4); index++) |
228 | *dmabuf++ = swab32(sgbuffer[index]); | 228 | *dmabuf++ = swab32(sgbuffer[index]); |
229 | } else { | 229 | } else { |
230 | memcpy(dmabuf, sgbuffer, amount); | 230 | char *tmpv = (char *)dmabuf; |
231 | dmabuf += amount; | 231 | memcpy(tmpv, sgbuffer, amount); |
232 | tmpv += amount; | ||
233 | dmabuf = (unsigned *)tmpv; | ||
232 | } | 234 | } |
233 | 235 | ||
234 | kunmap_atomic(sgbuffer, KM_BIO_SRC_IRQ); | 236 | kunmap_atomic(((void *)sgbuffer) - sg->offset, KM_BIO_SRC_IRQ); |
235 | 237 | ||
236 | if (size == 0) | 238 | if (size == 0) |
237 | break; | 239 | break; |