bdevsw_add() is broken
bdevsw_add() is broken
- Subject: bdevsw_add() is broken
- From: Sam Vaughan <email@hidden>
- Date: Thu, 3 Jul 2003 16:05:00 +1000
According to a comment in bdevsw_add() in xnu/bsd/kern/bsd_stubs.c, a
fix was applied to address Radar bug 2842228. I don't know the history
behind the fix, but it seems to have completely broken the function.
The change appears to be trying to skip the first item in the bdevsw
table by using an initial index value of 1. However the items are
being examined via the devsw pointer, not by indexing bdevsw. This
means that the index doesn't correspond to the item being examined.
The result is a bit of a mess. When I call bdevsw_add() with an index
of -1, the for() loop returns immediately because the first entry in
bdevsw is empty. Since index is 1 though, devsw then gets set to
bdevsw[1], which isn't empty. The second memcmp() fails and the
function returns -1.
If someone could kindly confirm for me that this is wrong, I'll post a
bug to Radar.
Thanks,
Sam
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.