netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] 3c515: Fix warning when building
@ 2013-10-25 21:59 Colin Rice
  2013-10-29  4:03 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Colin Rice @ 2013-10-25 21:59 UTC (permalink / raw)
  To: netdev; +Cc: Colin Rice


Signed-off-by: Colin Rice <ricec2@rpi.edu>
---
 drivers/net/ethernet/3com/3c515.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/3com/3c515.c b/drivers/net/ethernet/3com/3c515.c
index 94c656f..33ffda4 100644
--- a/drivers/net/ethernet/3com/3c515.c
+++ b/drivers/net/ethernet/3com/3c515.c
@@ -1063,7 +1063,7 @@ static netdev_tx_t corkscrew_start_xmit(struct sk_buff *skb,
 #ifdef VORTEX_BUS_MASTER
 	if (vp->bus_master) {
 		/* Set the bus-master controller to transfer the packet. */
-		outl((int) (skb->data), ioaddr + Wn7_MasterAddr);
+		outl((size_t) (skb->data), ioaddr + Wn7_MasterAddr);
 		outw((skb->len + 3) & ~3, ioaddr + Wn7_MasterLen);
 		vp->tx_skb = skb;
 		outw(StartDMADown, ioaddr + EL3_CMD);
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] 3c515: Fix warning when building
  2013-10-25 21:59 [PATCH net-next] 3c515: Fix warning when building Colin Rice
@ 2013-10-29  4:03 ` David Miller
  2013-10-29 19:31   ` Ben Hutchings
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2013-10-29  4:03 UTC (permalink / raw)
  To: ricec2; +Cc: netdev

From: Colin Rice <ricec2@rpi.edu>
Date: Fri, 25 Oct 2013 21:59:46 +0000

> -		outl((int) (skb->data), ioaddr + Wn7_MasterAddr);
> +		outl((size_t) (skb->data), ioaddr + Wn7_MasterAddr);

outl() takes an "int" not a "size_t".   You're avoiding the warning,
but on 64-bit, for example, you're silently allowing the compiler
to accept chopping off the top 32-bits of the 64-bit pointer address
off.

The warning is valid, this code won't work in certain environments,
and killing the warning is just papering over the problem such that
it will never get addressed properly.

I'm not applying patches like this, sorry.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] 3c515: Fix warning when building
  2013-10-29  4:03 ` David Miller
@ 2013-10-29 19:31   ` Ben Hutchings
       [not found]     ` <CAP8WD_b6i2+V30Gjo9fyYeEQfNCQBEKSHCUcAH0SJH1Z13CExg@mail.gmail.com>
  2013-10-29 20:06     ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Ben Hutchings @ 2013-10-29 19:31 UTC (permalink / raw)
  To: David Miller, ricec2; +Cc: netdev

On Tue, 2013-10-29 at 00:03 -0400, David Miller wrote:
> From: Colin Rice <ricec2@rpi.edu>
> Date: Fri, 25 Oct 2013 21:59:46 +0000
> 
> > -		outl((int) (skb->data), ioaddr + Wn7_MasterAddr);
> > +		outl((size_t) (skb->data), ioaddr + Wn7_MasterAddr);
> 
> outl() takes an "int" not a "size_t".   You're avoiding the warning,
> but on 64-bit, for example, you're silently allowing the compiler
> to accept chopping off the top 32-bits of the 64-bit pointer address
> off.
> 
> The warning is valid, this code won't work in certain environments,
> and killing the warning is just papering over the problem such that
> it will never get addressed properly.
> 
> I'm not applying patches like this, sorry.

The driver is writing a virtual address as the DMA address.  The
hardware is an ISA device and will presumably ignore the top 8 bits,
thus doing the virt-to-bus conversion for us.  Very efficient - so long
as this runs on a PC with no more than 16 MB RAM.

For other chips with a DMA descriptor ring, the driver uses
isa_virt_to_bus() which is less efficient but no more correct.

Maybe the driver should just be deleted, as it doesn't look like it's
actually usable any more.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] 3c515: Fix warning when building
       [not found]     ` <CAP8WD_b6i2+V30Gjo9fyYeEQfNCQBEKSHCUcAH0SJH1Z13CExg@mail.gmail.com>
@ 2013-10-29 20:00       ` Ben Hutchings
  0 siblings, 0 replies; 5+ messages in thread
From: Ben Hutchings @ 2013-10-29 20:00 UTC (permalink / raw)
  To: whiteheadm; +Cc: David Miller, Colin Rice, netdev

On Tue, 2013-10-29 at 15:55 -0400, tedheadster wrote:
> Ben,
> 
>   it is useful for teaching the very things we're seeing discussed in
> this thread. Please don't delete it.

It's useful as a bad example?  Well you can always point to an old
version of the driver in git even after it's deleted.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] 3c515: Fix warning when building
  2013-10-29 19:31   ` Ben Hutchings
       [not found]     ` <CAP8WD_b6i2+V30Gjo9fyYeEQfNCQBEKSHCUcAH0SJH1Z13CExg@mail.gmail.com>
@ 2013-10-29 20:06     ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2013-10-29 20:06 UTC (permalink / raw)
  To: bhutchings; +Cc: ricec2, netdev

From: Ben Hutchings <bhutchings@solarflare.com>
Date: Tue, 29 Oct 2013 19:31:57 +0000

> Maybe the driver should just be deleted, as it doesn't look like it's
> actually usable any more.

I'd like to agree, however I think the last time we had this
discussion someone said they were still using such a device :-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-10-29 20:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-25 21:59 [PATCH net-next] 3c515: Fix warning when building Colin Rice
2013-10-29  4:03 ` David Miller
2013-10-29 19:31   ` Ben Hutchings
     [not found]     ` <CAP8WD_b6i2+V30Gjo9fyYeEQfNCQBEKSHCUcAH0SJH1Z13CExg@mail.gmail.com>
2013-10-29 20:00       ` Ben Hutchings
2013-10-29 20:06     ` David Miller

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).