Intel ixgbe: uninitialized variable use in ixgbe_non_sfp_link_config()

From: Jesper Juhl
Date: Sun Jan 08 2012 - 16:23:41 EST


Hi (sorry about the duplicate, I messed up the LKML addr. on the first mail)

In ixgbe_non_sfp_link_config(), the variable 'negotiation' is declared
without initializer and unless we take the true branch in the 'if
((!autoneg) && (hw->mac.ops.get_link_capabilities))' statement it will
remain uninitialized when it is subsequently read in the 'ret =
hw->mac.ops.setup_link(hw, autoneg, negotiation, link_up)' statement.

The test of 'ret' after the 'if ((!autoneg) &&
(hw->mac.ops.get_link_capabilities))' statement also looks fairly
pointless if we do not take the true branch, since then 'ret' will not
have been changed since the previous identical test.

The correct fix escapes me since I don't really know this code (and don't
plan to spend the time to get to know it), but I thought I'd just report
what I had noticed and then someone else can hopefully come up with a good
fix :-)


PS. Please CC me on replies.

--
Jesper Juhl <jj@xxxxxxxxxxxxx> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/