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: <2183225.RrE6ZdDul9@wuerfel>
Date:	Fri, 18 Dec 2015 16:33:51 +0100
From:	Arnd Bergmann <arnd@...db.de>
To:	gregkh@...uxfoundation.org
Cc:	devel@...verdev.osuosl.org, linux-sh@...r.kernel.org,
	linux-usb@...r.kernel.org,
	Magnus Damm <damm+renesas@...nsource.se>,
	linux-kernel@...r.kernel.org, Felipe Balbi <balbi@...com>,
	Simon Horman <horms+renesas@...ge.net.au>,
	linux-arm-kernel@...ts.infradead.org
Subject: [PATCH RESENT] staging/emxx_udc: fix 64-bit warnings

ARCH_SHMOBILE is coming to arm64, which creates new warnings in allmodconfig:

drivers/staging/emxx_udc/emxx_udc.c: In function '_nbu2ss_out_dma':
drivers/staging/emxx_udc/emxx_udc.c:843:45: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  _nbu2ss_writel(&preg->EP_DCR[num].EP_TADR, (u32)pBuffer);

This is clearly a mistake from confusing a dma_addr_t with a pointer,
so the fix is to use the correct types in two places.

The third warning of this kind is a check for an unaligned pointer,
which should be done by casting the pointer to uintptr_t, not int.

Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
I sent this a month ago, here is the same patch again in case it got lost.

diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
index 4e6c16af40fc..c168845cbb91 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -823,7 +823,7 @@ static int _nbu2ss_out_dma(
 	u32		length
 )
 {
-	u8		*pBuffer;
+	dma_addr_t	pBuffer;
 	u32		mpkt;
 	u32		lmpkt;
 	u32		dmacnt;
@@ -836,7 +836,7 @@ static int _nbu2ss_out_dma(
 		return 1;		/* DMA is forwarded */
 
 	req->dma_flag = TRUE;
-	pBuffer = (u8 *)req->req.dma;
+	pBuffer = req->req.dma;
 	pBuffer += req->req.actual;
 
 	/* DMA Address */
@@ -1034,7 +1034,7 @@ static int _nbu2ss_in_dma(
 	u32		length
 )
 {
-	u8		*pBuffer;
+	dma_addr_t	pBuffer;
 	u32		mpkt;		/* MaxPacketSize */
 	u32		lmpkt;		/* Last Packet Data Size */
 	u32		dmacnt;		/* IN Data Size */
@@ -1080,7 +1080,7 @@ static int _nbu2ss_in_dma(
 	_nbu2ss_writel(&preg->EP_DCR[num].EP_DCR2, data);
 
 	/* Address setting */
-	pBuffer = (u8 *)req->req.dma;
+	pBuffer = req->req.dma;
 	pBuffer += req->req.actual;
 	_nbu2ss_writel(&preg->EP_DCR[num].EP_TADR, (u32)pBuffer);
 
@@ -2728,7 +2728,7 @@ static int nbu2ss_ep_queue(
 	spin_lock_irqsave(&udc->lock, flags);
 
 #ifdef USE_DMA
-	if ((u32)req->req.buf & 0x3)
+	if ((uintptr_t)req->req.buf & 0x3)
 		req->unaligned = TRUE;
 	else
 		req->unaligned = FALSE;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ