Skip to contentSkip to conversation

ice: remove an unneeded NULL check

PATCH New Dan Carpenter 3 participants 5 messages Oct 12, 2018 – Oct 17, 2018

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

PATCH 1/1 ice: remove an unneeded NULL check

We added a NULL check in commit 072f0c3db9da ("ice: Fix potential null pointer issues") but it causes static checker warnings.

    drivers/net/ethernet/intel/ice/ice_switch.c:2145 ice_add_to_vsi_fltr_list()
    warn: address of 'fm_entry->fltr_info' is non-NULL

We can just remove it.

drivers/net/ethernet/intel/ice/ice_switch.c +1 -1
index 33403f39f1b3..a9ef19da6e61 100644
@@ -2142,7 +2142,7 @@ ice_add_to_vsi_fltr_list(struct ice_hw *hw, u16 vsi_handle,
 		struct ice_fltr_info *fi;
 
 		fi = &fm_entry->fltr_info;
-		if (!fi || !ice_vsi_uses_fltr(fm_entry, vsi_handle))
+		if (!ice_vsi_uses_fltr(fm_entry, vsi_handle))
 			continue;
 
 		status = ice_add_entry_to_vsi_fltr_list(hw, vsi_handle,
#1 lore raw

PATCH 1/1 ice: remove an unneeded NULL check

Quoted 11 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Dan Carpenter
Sent: Friday, October 12, 2018 12:17 AM
To: Kirsher, Jeffrey T <[email protected]>; Ertman, David M <[email protected]>
Cc: kernel-janitors at vger.kernel.org; intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH] ice: remove an unneeded NULL check

We added a NULL check in commit 072f0c3db9da ("ice: Fix potential null pointer issues") but it causes static checker warnings.

Which static checker and with what options?

Quoted 27 lines
    drivers/net/ethernet/intel/ice/ice_switch.c:2145 ice_add_to_vsi_fltr_list()
    warn: address of 'fm_entry->fltr_info' is non-NULL

We can just remove it.

drivers/net/ethernet/intel/ice/ice_switch.c +1 -1
index 33403f39f1b3..a9ef19da6e61 100644
@@ -2142,7 +2142,7 @@ ice_add_to_vsi_fltr_list(struct ice_hw *hw, u16
 vsi_handle,
 		struct ice_fltr_info *fi;
 
 		fi = &fm_entry->fltr_info;
-		if (!fi || !ice_vsi_uses_fltr(fm_entry, vsi_handle))
+		if (!ice_vsi_uses_fltr(fm_entry, vsi_handle))
 			continue;
 

status = ice_add_entry_to_vsi_fltr_list(hw, vsi_handle,
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#2 lore raw

PATCH 1/1 ice: remove an unneeded NULL check

Quoted 9 lines · Bruce W
Quoted 9 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Dan Carpenter
Sent: Friday, October 12, 2018 12:17 AM
To: Kirsher, Jeffrey T <[email protected]>; Ertman, David M <[email protected]>
Cc: kernel-janitors at vger.kernel.org; intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH] ice: remove an unneeded NULL check

Quoted 5 lines
Quoted 2 lines

We added a NULL check in commit 072f0c3db9da ("ice: Fix potential null pointer issues") but it causes static checker warnings.

Which static checker and with what options?

Future versions of Smatch will complain probably. It turns out there are many many unnecessary NULL checks and they seldome indicate a bug so I'm waffling on this...

regards,
dan carpenter

#3 lore raw

PATCH 1/1 ice: remove an unneeded NULL check

Quoted 13 lines · Dan Carpenter
Quoted 12 lines · Bruce W
Quoted 11 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Dan Carpenter
Sent: Friday, October 12, 2018 12:17 AM
To: Kirsher, Jeffrey T <[email protected]>; Ertman, David M <[email protected]>
Cc: kernel-janitors at vger.kernel.org; intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH] ice: remove an unneeded NULL check

We added a NULL check in commit 072f0c3db9da ("ice: Fix potential null pointer issues") but it causes static checker warnings.

Quoted 6 lines
Quoted 2 lines

Which static checker and with what options?

Future versions of Smatch will complain probably. It turns out there are many many unnecessary NULL checks and they seldome indicate a bug so I'm waffling on this...

I don't see how fi could ever be NULL. It's set to the address of fm_entry->fltr_info.

Given that, it really seems like the check should go, since it is clearly unnecessary.

-Dave

Quoted 9 lines

regards,
dan carpenter

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#4 lore raw

PATCH 1/1 ice: remove an unneeded NULL check

In reply to Dan Carpenter
Quoted 12 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Dan Carpenter
Sent: Friday, October 12, 2018 12:17 AM
To: Kirsher, Jeffrey T <[email protected]>; Ertman, David M <[email protected]>
Cc: kernel-janitors at vger.kernel.org; intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH] ice: remove an unneeded NULL check

We added a NULL check in commit 072f0c3db9da ("ice: Fix potential null pointer issues") but it causes static checker warnings.

Quoted 6 lines
    drivers/net/ethernet/intel/ice/ice_switch.c:2145 ice_add_to_vsi_fltr_list()
    warn: address of 'fm_entry->fltr_info' is non-NULL

We can just remove it.