From: Vince Bridgers <vbridgers2013@gmail.com>
To: netdev@vger.kernel.org
Cc: vbridgers2013@gmail.com
Subject: [PATCH net-next 2/3] Altera TSE: Correct typecast issue detected by kbuild test robot
Date: Thu, 20 Mar 2014 20:43:16 -0500 [thread overview]
Message-ID: <1395366197-9781-3-git-send-email-vbridgers2013@gmail.com> (raw)
In-Reply-To: <1395366197-9781-1-git-send-email-vbridgers2013@gmail.com>
This patch addresses a portable pointer arithmetic issue in the
original submission found by the kbuild test robot.
config: make ARCH=i386 allyesconfig
altera_sgdma.c: In function 'sgdma_txphysaddr':
>> altera_sgdma.c:393:33: warning: cast from
>> pointer to integer of different size [-Wpointer-to-int-cast]
dma_addr_t offs = (dma_addr_t)((dma_addr_t)desc -
^
>> altera_sgdma.c:394:5: warning: cast from
>> pointer to integer of different size [-Wpointer-to-int-cast]
(dma_addr_t)priv->tx_dma_desc);
^
altera_sgdma.c: In function 'sgdma_rxphysaddr':
>> altera_sgdma.c:403:33: warning: cast from
>> pointer to integer of different size [-Wpointer-to-int-cast]
dma_addr_t offs = (dma_addr_t)((dma_addr_t)desc -
^
>> altera_sgdma.c:404:5: warning: cast from
>> pointer to integer of different size [-Wpointer-to-int-cast]
(dma_addr_t)priv->rx_dma_desc);
^
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Vince Bridgers <vbridgers2013@gmail.com>
---
drivers/net/ethernet/altera/altera_sgdma.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/altera/altera_sgdma.c b/drivers/net/ethernet/altera/altera_sgdma.c
index cbeee07..ebc4840 100644
--- a/drivers/net/ethernet/altera/altera_sgdma.c
+++ b/drivers/net/ethernet/altera/altera_sgdma.c
@@ -390,9 +390,8 @@ sgdma_txphysaddr(struct altera_tse_private *priv,
struct sgdma_descrip *desc)
{
dma_addr_t paddr = priv->txdescmem_busaddr;
- dma_addr_t offs = (dma_addr_t)((dma_addr_t)desc -
- (dma_addr_t)priv->tx_dma_desc);
- return paddr + offs;
+ uintptr_t offs = (uintptr_t)desc - (uintptr_t)priv->tx_dma_desc;
+ return (dma_addr_t)((uintptr_t)paddr + offs);
}
static dma_addr_t
@@ -400,9 +399,8 @@ sgdma_rxphysaddr(struct altera_tse_private *priv,
struct sgdma_descrip *desc)
{
dma_addr_t paddr = priv->rxdescmem_busaddr;
- dma_addr_t offs = (dma_addr_t)((dma_addr_t)desc -
- (dma_addr_t)priv->rx_dma_desc);
- return paddr + offs;
+ uintptr_t offs = (uintptr_t)desc - (uintptr_t)priv->rx_dma_desc;
+ return (dma_addr_t)((uintptr_t)paddr + offs);
}
#define list_remove_head(list, entry, type, member) \
--
1.7.9.5
next prev parent reply other threads:[~2014-03-21 1:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-21 1:43 [PATCH net-next 0/3] Altera TSE: Misc driver updates Vince Bridgers
2014-03-21 1:43 ` [PATCH net-next 1/3] Altera TSE: Set version number by driver's get regs Vince Bridgers
2014-03-21 19:36 ` David Miller
2014-03-21 1:43 ` Vince Bridgers [this message]
2014-03-21 19:37 ` [PATCH net-next 2/3] Altera TSE: Correct typecast issue detected by kbuild test robot David Miller
2014-03-21 1:43 ` [PATCH net-next 3/3] Altera TSE: Correct two typos in original submission Vince Bridgers
2014-03-21 19:37 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1395366197-9781-3-git-send-email-vbridgers2013@gmail.com \
--to=vbridgers2013@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).