Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1261887 > unrolled thread
| Started by | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| First post | 2015-11-03 21:50 +0100 |
| Last post | 2015-11-03 22:00 +0100 |
| Articles | 4 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 0/3] batman-adv: Deletion of a few unnecessary checks SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-03 21:50 +0100
[PATCH 3/3] batman-adv: Less function calls in batadv_is_ap_isolated() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-03 22:00 +0100
[PATCH 2/3] batman-adv: Split a condition check SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-03 22:00 +0100
[PATCH 1/3] batman-adv: Delete an unnecessary check before the function call "batadv_softif_vlan_free_ref" SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-03 22:00 +0100
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-11-03 21:50 +0100 |
| Subject | [PATCH 0/3] batman-adv: Deletion of a few unnecessary checks |
| Message-ID | <qqQGJ-7Hz-9@gated-at.bofh.it> |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Tue, 3 Nov 2015 21:34:29 +0100 Further update suggestions were taken into account after a patch was applied from static source code analysis. Markus Elfring (3): Delete an unnecessary check before the function call "batadv_softif_vlan_free_ref" Split a condition check Less function calls in batadv_is_ap_isolated() after error detection net/batman-adv/translation-table.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-11-03 22:00 +0100 |
| Subject | [PATCH 3/3] batman-adv: Less function calls in batadv_is_ap_isolated() after error detection |
| Message-ID | <qqQQp-7KR-1@gated-at.bofh.it> |
| In reply to | #1261887 |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Tue, 3 Nov 2015 21:10:51 +0100 The variables "tt_local_entry" and "tt_global_entry" were eventually checked again despite of a corresponding null pointer test before. Let us avoid this double check by reordering a function call sequence and the better selection of jump targets. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- net/batman-adv/translation-table.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 965a004..3ac32d9 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c @@ -3323,27 +3323,24 @@ bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst, return false; if (!atomic_read(&vlan->ap_isolation)) - goto out; + goto vlan_free; tt_local_entry = batadv_tt_local_hash_find(bat_priv, dst, vid); if (!tt_local_entry) - goto out; + goto vlan_free; tt_global_entry = batadv_tt_global_hash_find(bat_priv, src, vid); if (!tt_global_entry) - goto out; + goto local_entry_free; - if (!_batadv_is_ap_isolated(tt_local_entry, tt_global_entry)) - goto out; - - ret = true; + if (_batadv_is_ap_isolated(tt_local_entry, tt_global_entry)) + ret = true; -out: + batadv_tt_global_entry_free_ref(tt_global_entry); +local_entry_free: + batadv_tt_local_entry_free_ref(tt_local_entry); +vlan_free: batadv_softif_vlan_free_ref(vlan); - if (tt_global_entry) - batadv_tt_global_entry_free_ref(tt_global_entry); - if (tt_local_entry) - batadv_tt_local_entry_free_ref(tt_local_entry); return ret; } -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-11-03 22:00 +0100 |
| Subject | [PATCH 2/3] batman-adv: Split a condition check |
| Message-ID | <qqQQp-7KR-11@gated-at.bofh.it> |
| In reply to | #1261887 |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Tue, 3 Nov 2015 20:41:02 +0100 Let us split a check for a condition at the beginning of the batadv_is_ap_isolated() function so that a direct return can be performed in this function if the variable "vlan" contained a null pointer. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- net/batman-adv/translation-table.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 48315de..965a004 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c @@ -3319,7 +3319,10 @@ bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst, bool ret = false; vlan = batadv_softif_vlan_get(bat_priv, vid); - if (!vlan || !atomic_read(&vlan->ap_isolation)) + if (!vlan) + return false; + + if (!atomic_read(&vlan->ap_isolation)) goto out; tt_local_entry = batadv_tt_local_hash_find(bat_priv, dst, vid); -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-11-03 22:00 +0100 |
| Subject | [PATCH 1/3] batman-adv: Delete an unnecessary check before the function call "batadv_softif_vlan_free_ref" |
| Message-ID | <qqQQq-7KR-13@gated-at.bofh.it> |
| In reply to | #1261887 |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Tue, 3 Nov 2015 19:20:34 +0100 The batadv_softif_vlan_free_ref() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- net/batman-adv/translation-table.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 4228b10..48315de 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c @@ -3336,8 +3336,7 @@ bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst, ret = true; out: - if (vlan) - batadv_softif_vlan_free_ref(vlan); + batadv_softif_vlan_free_ref(vlan); if (tt_global_entry) batadv_tt_global_entry_free_ref(tt_global_entry); if (tt_local_entry) -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web