Skip to contentSkip to conversation

bonding: fix sparse warnings

PATCH In review Stephen Hemminger 2 participants 3 messages May 10, 2006 – May 11, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bonding: fix sparse warnings

Fix warning from sparse in bonding code about "incorrect type in assignment"

drivers/net/bonding/bond_main.c +2 -2
@@ -629,7 +629,7 @@
 	ioctl = slave_dev->do_ioctl;
 	strncpy(ifr.ifr_name, slave_dev->name, IFNAMSIZ);
 	etool.cmd = ETHTOOL_GSET;
-	ifr.ifr_data = (char*)&etool;
+	ifr.ifr_data = (void __user *) &etool;
 	if (!ioctl || (IOCTL(slave_dev, &ifr, SIOCETHTOOL) < 0)) {
 		return -1;
 	}
@@ -726,7 +726,7 @@
 	if (ioctl) {
 		strncpy(ifr.ifr_name, slave_dev->name, IFNAMSIZ);
 		etool.cmd = ETHTOOL_GLINK;
-		ifr.ifr_data = (char*)&etool;
+		ifr.ifr_data = (void __user *) &etool;
 		if (IOCTL(slave_dev, &ifr, SIOCETHTOOL) == 0) {
 			if (etool.data == 1) {
 				return BMSR_LSTATUS;
#1 lore raw
Quoted 1 line · Stephen Hemminger

Fix warning from sparse in bonding code about "incorrect type in assignment"

*snerk*

Only if you are building without -Wcast-to-as. It _is_ incorrect type in assignment. And the real fix is to expand the call, killing set_fs() in there.

#2 lore raw
Quoted 8 lines · On Thu, 11 May 2006 00:22:03 +0100 Al Viro <[email protected]> wrote:
Quoted 1 line · Stephen Hemminger

Fix warning from sparse in bonding code about "incorrect type in assignment"

*snerk*

Only if you are building without -Wcast-to-as. It _is_ incorrect type in assignment. And the real fix is to expand the call, killing set_fs() in there.

More like this (in br_if.c)?

	struct ethtool_cmd ecmd = { ETHTOOL_GSET };
	struct ifreq ifr;
	mm_segment_t old_fs;
	int err;

	strncpy(ifr.ifr_name, dev->name, IFNAMSIZ);
	ifr.ifr_data = (void __user *) &ecmd;

	old_fs = get_fs();
	set_fs(KERNEL_DS);
	err = dev_ethtool(&ifr);
	set_fs(old_fs);
	
	if (!err)
		...