lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20190121112622.127542-1-andre.przywara@arm.com>
Date:   Mon, 21 Jan 2019 11:26:22 +0000
From:   Andre Przywara <andre.przywara@....com>
To:     Vinod Koul <vkoul@...nel.org>
Cc:     dmaengine@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org, Lucas Stach <l.stach@...gutronix.de>,
        Baruch Siach <baruch@...s.co.il>
Subject: [PATCH] dma: imx: Fix arm64 compilation issue due to min() size issue

Compiling the i.MX DMA driver for arm64 results in a warning due to
imxdma_desc->len being a size_t, while scatterlist->len being an uint:

drivers/dma/imx-dma.c: In function ‘imxdma_sg_next’:
/src/linux/include/linux/kernel.h:846:29: warning: comparison of distinct pointer types lacks a cast
   (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
...
drivers/dma/imx-dma.c:288:8: note: in expansion of macro ‘min’
  now = min(d->len, sg_dma_len(sg));
        ^~~

I am not sure if size_t is the right type for len in the first place,
but anyway the fix is pretty simple.

This fixes compiling an arm64 kernel with i.MX (DMA) support enabled.

Signed-off-by: Andre Przywara <andre.przywara@....com>
---
Hi,

apologies if this has been sent already (just ignore it then), but I
couldn't find anything quickly enough. I see this since -rc1, but it's
still annoying me in -rc3, hence this patch.

Cheers,
Andre.

 drivers/dma/imx-dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
index c2fff3f6c9ca..fa3ef43fe314 100644
--- a/drivers/dma/imx-dma.c
+++ b/drivers/dma/imx-dma.c
@@ -285,7 +285,7 @@ static inline int imxdma_sg_next(struct imxdma_desc *d)
 	struct scatterlist *sg = d->sg;
 	unsigned long now;
 
-	now = min(d->len, sg_dma_len(sg));
+	now = min_t(size_t, d->len, sg_dma_len(sg));
 	if (d->len != IMX_DMA_LENGTH_LOOP)
 		d->len -= now;
 
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ