diff mbox

xen/arm: Return correct code error for xen_swiotlb_map_page

Message ID 1415293651-13917-1-git-send-email-frediano.ziglio@huawei.com
State New
Headers show

Commit Message

Frediano Ziglio Nov. 6, 2014, 5:07 p.m. UTC
On ARM error code is not 0 so avoid to return it as error.

Signed-off-by: Frediano Ziglio <frediano.ziglio@huawei.com>
---
 drivers/xen/swiotlb-xen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefano Stabellini Nov. 6, 2014, 5:30 p.m. UTC | #1
On Thu, 6 Nov 2014, Frediano Ziglio wrote:
> On ARM error code is not 0 so avoid to return it as error.
> 
> Signed-off-by: Frediano Ziglio <frediano.ziglio@huawei.com>

Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>


Could you please fix the same error in lib/swiotlb.c too please?

>  drivers/xen/swiotlb-xen.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
> index ebd8f21..3b8d628 100644
> --- a/drivers/xen/swiotlb-xen.c
> +++ b/drivers/xen/swiotlb-xen.c
> @@ -425,7 +425,7 @@ dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
>  	 */
>  	if (!dma_capable(dev, dev_addr, size)) {
>  		swiotlb_tbl_unmap_single(dev, map, size, dir);
> -		dev_addr = 0;
> +		dev_addr = DMA_ERROR_CODE;
>  	}
>  	return dev_addr;
>  }
> -- 
> 1.9.1
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://secure-web.cisco.com/1cvjROyUxV6SnA0uBTMRubqrQWsaXGhps-FWjY3vly9AxaKKlt2DPY7GjL0FCHeP4rsbjKsc-P4zH2_7-kpcxwEH-udGrGCCqkCLlH1-fLOo1X6Nlui6EwEVHUpB2r7gt-Gsgxbep9QWPnIdypDPNf8Hf5clxCMXYcvWsOK5s3qg/http%3A%2F%2Fwww.tux.org%2Flkml%2F
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Frediano Ziglio Nov. 6, 2014, 7:05 p.m. UTC | #2
2014-11-06 17:30 GMT+00:00 Stefano Stabellini <
stefano.stabellini@eu.citrix.com>:

> On Thu, 6 Nov 2014, Frediano Ziglio wrote:
> > On ARM error code is not 0 so avoid to return it as error.
> >
> > Signed-off-by: Frediano Ziglio <frediano.ziglio@huawei.com>
>
> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>
>
> Could you please fix the same error in lib/swiotlb.c too please?
>
>
Same patch or another ?

Frediano


> >  drivers/xen/swiotlb-xen.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
> > index ebd8f21..3b8d628 100644
> > --- a/drivers/xen/swiotlb-xen.c
> > +++ b/drivers/xen/swiotlb-xen.c
> > @@ -425,7 +425,7 @@ dma_addr_t xen_swiotlb_map_page(struct device *dev,
> struct page *page,
> >        */
> >       if (!dma_capable(dev, dev_addr, size)) {
> >               swiotlb_tbl_unmap_single(dev, map, size, dir);
> > -             dev_addr = 0;
> > +             dev_addr = DMA_ERROR_CODE;
> >       }
> >       return dev_addr;
> >  }
> > --
> > 1.9.1
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel"
> in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at
> http://secure-web.cisco.com/1cvjROyUxV6SnA0uBTMRubqrQWsaXGhps-FWjY3vly9AxaKKlt2DPY7GjL0FCHeP4rsbjKsc-P4zH2_7-kpcxwEH-udGrGCCqkCLlH1-fLOo1X6Nlui6EwEVHUpB2r7gt-Gsgxbep9QWPnIdypDPNf8Hf5clxCMXYcvWsOK5s3qg/http%3A%2F%2Fwww.tux.org%2Flkml%2F
> >
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
>
Stefano Stabellini Nov. 6, 2014, 7:14 p.m. UTC | #3
On Thu, 6 Nov 2014, Frediano Ziglio wrote:
> 2014-11-06 17:30 GMT+00:00 Stefano Stabellini <stefano.stabellini@eu.citrix.com>:
>       On Thu, 6 Nov 2014, Frediano Ziglio wrote:
>       > On ARM error code is not 0 so avoid to return it as error.
>       >
>       > Signed-off-by: Frediano Ziglio <frediano.ziglio@huawei.com>
> 
>       Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> 
> 
>       Could you please fix the same error in lib/swiotlb.c too please?
> 
> 
> Same patch or another ?
> 

Another

>  
>       >  drivers/xen/swiotlb-xen.c | 2 +-
>       >  1 file changed, 1 insertion(+), 1 deletion(-)
>       >
>       > diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
>       > index ebd8f21..3b8d628 100644
>       > --- a/drivers/xen/swiotlb-xen.c
>       > +++ b/drivers/xen/swiotlb-xen.c
>       > @@ -425,7 +425,7 @@ dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
>       >        */
>       >       if (!dma_capable(dev, dev_addr, size)) {
>       >               swiotlb_tbl_unmap_single(dev, map, size, dir);
>       > -             dev_addr = 0;
>       > +             dev_addr = DMA_ERROR_CODE;
>       >       }
>       >       return dev_addr;
>       >  }
>       > --
>       > 1.9.1
>       >
>       >
>       > --
>       > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>       > the body of a message to majordomo@vger.kernel.org
>       > More majordomo info at  http://vger.kernel.org/majordomo-info.html
>       > Please read the FAQ at http://secure-web.cisco.com/1cvjROyUxV6SnA0uBTMRubqrQWsaXGhps-FWjY3vly9AxaKKlt2DPY7GjL0FCHeP4rsbjKsc-P4zH2_7-kpcxwEH-udGrGCCq
>       kCLlH1-fLOo1X6Nlui6EwEVHUpB2r7gt-Gsgxbep9QWPnIdypDPNf8Hf5clxCMXYcvWsOK5s3qg/http%3A%2F%2Fwww.tux.org%2Flkml%2F
>       >
> 
>       _______________________________________________
>       Xen-devel mailing list
>       Xen-devel@lists.xen.org
>       http://lists.xen.org/xen-devel
> 
> 
> 
>
Frediano Ziglio Nov. 7, 2014, 9:56 a.m. UTC | #4
> On Thu, 6 Nov 2014, Frediano Ziglio wrote:

> > 2014-11-06 17:30 GMT+00:00 Stefano Stabellini

> <stefano.stabellini@eu.citrix.com>:

> >       On Thu, 6 Nov 2014, Frediano Ziglio wrote:

> >       > On ARM error code is not 0 so avoid to return it as error.

> >       >

> >       > Signed-off-by: Frediano Ziglio <frediano.ziglio@huawei.com>

> >

> >       Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

> >

> >

> >       Could you please fix the same error in lib/swiotlb.c too please?

> >

> >

> > Same patch or another ?

> >

> 

> Another

> 


lib/swiotlb.c is not affected at a physical address to io_tlb_overflow_buffer is returned in case of error.
Looks like a way to transform silently an allocation error to a more serious memory corruption.

Frediano

> >

> >       >  drivers/xen/swiotlb-xen.c | 2 +-

> >       >  1 file changed, 1 insertion(+), 1 deletion(-)

> >       >

> >       > diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-

> xen.c

> >       > index ebd8f21..3b8d628 100644

> >       > --- a/drivers/xen/swiotlb-xen.c

> >       > +++ b/drivers/xen/swiotlb-xen.c

> >       > @@ -425,7 +425,7 @@ dma_addr_t xen_swiotlb_map_page(struct

> device *dev, struct page *page,

> >       >        */

> >       >       if (!dma_capable(dev, dev_addr, size)) {

> >       >               swiotlb_tbl_unmap_single(dev, map, size, dir);

> >       > -             dev_addr = 0;

> >       > +             dev_addr = DMA_ERROR_CODE;

> >       >       }

> >       >       return dev_addr;

> >       >  }

> >       > --

> >       > 1.9.1

> >       >

> >       >

> >       > --

> >       > To unsubscribe from this list: send the line "unsubscribe

> linux-kernel" in

> >       > the body of a message to majordomo@vger.kernel.org

> >       > More majordomo info at  http://vger.kernel.org/majordomo-

> info.html

> >       > Please read the FAQ at http://secure-

> web.cisco.com/1cvjROyUxV6SnA0uBTMRubqrQWsaXGhps-

> FWjY3vly9AxaKKlt2DPY7GjL0FCHeP4rsbjKsc-P4zH2_7-kpcxwEH-udGrGCCq

> >       kCLlH1-fLOo1X6Nlui6EwEVHUpB2r7gt-

> Gsgxbep9QWPnIdypDPNf8Hf5clxCMXYcvWsOK5s3qg/http%3A%2F%2Fwww.tux.org%2Fl

> kml%2F

> >       >

> >

> >       _______________________________________________

> >       Xen-devel mailing list

> >       Xen-devel@lists.xen.org

> >       http://lists.xen.org/xen-devel

> >

> >

> >

> >
diff mbox

Patch

diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
index ebd8f21..3b8d628 100644
--- a/drivers/xen/swiotlb-xen.c
+++ b/drivers/xen/swiotlb-xen.c
@@ -425,7 +425,7 @@  dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
 	 */
 	if (!dma_capable(dev, dev_addr, size)) {
 		swiotlb_tbl_unmap_single(dev, map, size, dir);
-		dev_addr = 0;
+		dev_addr = DMA_ERROR_CODE;
 	}
 	return dev_addr;
 }