Problem with IFDATA_DRIVERNAME sysctl

Brooks Davis brooks at freebsd.org
Wed Sep 10 00:35:47 UTC 2008


On Wed, Sep 10, 2008 at 01:13:33AM +0100, Bruce M. Simpson wrote:
> Bruce M Simpson wrote:
>> 
>> It looks like the switch..case in that path could be fubar'd by the 
>> compiler as there are not break statements for each distinct case label, 
>> could this be due to gcc friendly fire?
> 
> Possibly false alarm or PEBKAC, I wasn't checking return values right in 
> some of my code, although we should probably have "break" there anyway.
> 
> Patch against RELENG_7_0.

> --- if_mib.c.orig	2008-09-10 00:31:25.000000000 +0100
> +++ if_mib.c	2008-09-10 00:32:15.000000000 +0100
> @@ -90,6 +90,7 @@
>  	switch(name[1]) {
>  	default:
>  		return ENOENT;
> +		break;

That's clearly a no-op since it's unreachable.

>  	case IFDATA_GENERAL:
>  		bzero(&ifmd, sizeof(ifmd));
> @@ -136,6 +137,7 @@
>  		error = SYSCTL_IN(req, ifp->if_linkmib, ifp->if_linkmiblen);
>  		if (error)
>  			return error;
> +		break;

This looks OK, but I haven't checked the context.

>  
>  	case IFDATA_DRIVERNAME:
>  		/* 20 is enough for 64bit ints */
> @@ -152,6 +154,7 @@
>  			error = EPERM;
>  		free(dbuf, M_TEMP);
>  		return (error);
> +		break;

This is also a no-op.

--Brooks

>  	}
>  	return 0;
>  }

> _______________________________________________
> freebsd-net at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20080910/8d36f488/attachment.pgp


More information about the freebsd-net mailing list