]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
sdhci: add warnings for bad buffers in ADMA path
authorPierre Ossman <drzeus@drzeus.cx>
Sun, 20 Jul 2008 22:45:15 +0000 (00:45 +0200)
committerPierre Ossman <drzeus@drzeus.cx>
Wed, 23 Jul 2008 12:42:09 +0000 (14:42 +0200)
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: Pierre Ossman <drzeus@drzeus.cx>
drivers/mmc/host/sdhci.c

index 17701c3da73326b9fa796086a617b253c506b1e5..b27c1a28a7cadb6ad2c9773bff96fe4728ac22d1 100644 (file)
@@ -389,6 +389,7 @@ static int sdhci_adma_table_pre(struct sdhci_host *host,
                if (offset) {
                        if (data->flags & MMC_DATA_WRITE) {
                                buffer = sdhci_kmap_atomic(sg, &flags);
+                               WARN_ON(((long)buffer & PAGE_MASK) > (PAGE_SIZE - 3));
                                memcpy(align, buffer, offset);
                                sdhci_kunmap_atomic(buffer, &flags);
                        }
@@ -510,6 +511,7 @@ static void sdhci_adma_table_post(struct sdhci_host *host,
                                size = 4 - (sg_dma_address(sg) & 0x3);
 
                                buffer = sdhci_kmap_atomic(sg, &flags);
+                               WARN_ON(((long)buffer & PAGE_MASK) > (PAGE_SIZE - 3));
                                memcpy(buffer, align, size);
                                sdhci_kunmap_atomic(buffer, &flags);