Commit 6cefd05f authored by Pierre Ossman's avatar Pierre Ossman

sdhci: add warnings for bad buffers in ADMA path

The ADMA code path assumes that the 3 byte alignment fix doesn't cross
a page boundary. I'm not convinced this is worth supporting, but at
least print a warning in the off chance we'll actually see such a request.
Signed-off-by: default avatarPierre Ossman <drzeus@drzeus.cx>
parent 48b5352e
...@@ -389,6 +389,7 @@ static int sdhci_adma_table_pre(struct sdhci_host *host, ...@@ -389,6 +389,7 @@ static int sdhci_adma_table_pre(struct sdhci_host *host,
if (offset) { if (offset) {
if (data->flags & MMC_DATA_WRITE) { if (data->flags & MMC_DATA_WRITE) {
buffer = sdhci_kmap_atomic(sg, &flags); buffer = sdhci_kmap_atomic(sg, &flags);
WARN_ON(((long)buffer & PAGE_MASK) > (PAGE_SIZE - 3));
memcpy(align, buffer, offset); memcpy(align, buffer, offset);
sdhci_kunmap_atomic(buffer, &flags); sdhci_kunmap_atomic(buffer, &flags);
} }
...@@ -510,6 +511,7 @@ static void sdhci_adma_table_post(struct sdhci_host *host, ...@@ -510,6 +511,7 @@ static void sdhci_adma_table_post(struct sdhci_host *host,
size = 4 - (sg_dma_address(sg) & 0x3); size = 4 - (sg_dma_address(sg) & 0x3);
buffer = sdhci_kmap_atomic(sg, &flags); buffer = sdhci_kmap_atomic(sg, &flags);
WARN_ON(((long)buffer & PAGE_MASK) > (PAGE_SIZE - 3));
memcpy(buffer, align, size); memcpy(buffer, align, size);
sdhci_kunmap_atomic(buffer, &flags); sdhci_kunmap_atomic(buffer, &flags);
......
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