Re: SIS 900 warning fixes + bogus mcast set_bit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 23 Oct 2002, bert hubert wrote:

> sis900.c tries to printk longs as ints.

To be accurate, the source assumes that the return value of inl() is an
type promoted to an 'int'.  That was once true.

The proper fix is not what you suggest, but rather to cast the return
value of inl() to an 'int' for these status/debug statements.

> Furthermore, it contains the following around line 2095 in 2.5.44:
> 
> for (i = 0, mclist = net_dev->mc_list; mclist && i < net_dev->mc_count;
>      i++, mclist = mclist->next)
> 	set_bit(sis900_compute_hashtable_index(mclist->dmi_addr, revision),
> 		mc_filter);
> 
> where mc_filter is u16 mc_filter[16]. This looks highly bogus, perhaps it
> should be mc_filter[i].

No, definitely not.  The multicast filter is a bit vector.  It is
declared as an 16*16 array because that matches how the NIC expects the
bit vector to be written to its registers.

> A fix for the warning is attached, please apply.

You have identified a problem, but this is not the correct fix.

> --- linux-2.5.44/drivers/net/sis900.c~orig	Wed Oct 23 19:50:40 2002
> +++ linux-2.5.44/drivers/net/sis900.c	Wed Oct 23 19:53:34 2002
> @@ -973,7 +973,7 @@
>  		outl(w, ioaddr + rfdr);
>  
>  		if (sis900_debug > 2) {
> -			printk(KERN_INFO "%s: Receive Filter Addrss[%d]=%x\n",
> +			printk(KERN_INFO "%s: Receive Filter Addrss[%d]=%lx\n",
>  			       net_dev->name, i, inl(ioaddr + rfdr));

		if (sis900_debug > 2) {
			printk(KERN_INFO "%s: Receive Filter Addrss[%d]=%x\n",
- 			       net_dev->name, i, inl(ioaddr + rfdr));
+ 			       net_dev->name, i, (int)inl(ioaddr + rfdr));


-- 
Donald Becker				becker@scyld.com
Scyld Computing Corporation		http://www.scyld.com
410 Severn Ave. Suite 210		Scyld Beowulf cluster system
Annapolis MD 21403			410-990-9993

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux