Re: [PATCH] drivers: atm: eni: Add pci_dma_mapping_error() call
From: David Miller
Date: Mon Nov 10 2014 - 15:32:37 EST
From: Tina Johnson <tinajohnson.1234@xxxxxxxxx>
Date: Sat, 8 Nov 2014 21:48:02 +0530
> Added a pci_dma_mapping_error() call to check for mapping errors before
> further using the dma handle. Unchecked dma handles were found using
> Coccinelle:
>
> @rule1@
> expression e1;
> identifier x;
> @@
>
> *x = pci_map_single(...);
> ... when != pci_dma_mapping_error(e1,x)
>
> Signed-off-by: Tina Johnson <tinajohnson.1234@xxxxxxxxx>
> Acked-by: Julia Lawall <julia.lawall@xxxxxxx>
I really don't like quick fixes like this, exactly because of the
kind of new bug this change is introducing.
The 'trouble' label assumes that it is recovering and unwinding state
when an error occurs after the DMA buffer is successfully mapped.
It unconditionally does pci_unmap_single() if 'paddr' is non-zero
which it might be in the error case depending upon how DMA errors
are represented on a given platform.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/