fm10k: prevent possibly uninitialized variable
authorBruce Allan <bruce.w.allan@intel.com>
Wed, 10 Feb 2016 22:45:47 +0000 (14:45 -0800)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 5 Apr 2016 19:49:31 +0000 (12:49 -0700)
If 'attr_flag < (1 << (2 * FM10K_TEST_MSG_NESTED))' is ever false, err
will be used uninitialized.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c

index c67121cc7b235a215f2b068d81aea08014ce558e..2e4ea886185239db8874a1318c08f8417c7665c6 100644 (file)
@@ -937,7 +937,7 @@ static int fm10k_mbx_test(struct fm10k_intfc *interface, u64 *data)
        struct fm10k_mbx_info *mbx = &hw->mbx;
        u32 attr_flag, test_msg[6];
        unsigned long timeout;
-       int err;
+       int err = -EINVAL;
 
        /* For now this is a VF only feature */
        if (hw->mac.type != fm10k_mac_vf)