Mentions légales du service

Skip to content

drivers/dma: fix bug that may copy one byte too much

Daniel Krebs requested to merge fix/dma_excess_byte into master

This happens when src and dst are odd and len is even.

Example:

  • dst = 0x13, src = 0x41, len = 14

Calculate length of DMA copy:

  • -> dma0sz = len / 2 = 7

The first byte will be manually copied to word-align src and dst:

  • -> dst = 0x14, src = 0x42, len = 13

Now the DMA transfer will copy 7 words (= 14 bytes), although only 13 bytes should be copied. This will therefore corrupt memory @ dst + len.

Edited by Daniel Krebs

Merge request reports

Loading