aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2015-05-31 20:44:45 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2015-06-08 18:34:19 -0400
commit2622e2a03cd7320f57a4f5171c242dccdab035dd (patch)
tree7cf56686031b93f5476841aeac444de9bf920a6f /net/nfc
parent8a2151c587715e84af676ee6c210fd41b912de76 (diff)
NFC: nci: hci: Fix releasing uninitialized skbs
Several of these goto exit; uses should be direct returns as skb is not yet initialized by nci_hci_get_param(). Miscellanea: o Use !memcmp instead of memcmp() == 0 o Remove unnecessary goto from if () {... goto exit;} else {...} exit: Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/nci/hci.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/net/nfc/nci/hci.c b/net/nfc/nci/hci.c
index ed54ec533836..af002df640c7 100644
--- a/net/nfc/nci/hci.c
+++ b/net/nfc/nci/hci.c
@@ -639,22 +639,19 @@ int nci_hci_dev_session_init(struct nci_dev *ndev)
639 ndev->hci_dev->init_data.gates[0].gate, 639 ndev->hci_dev->init_data.gates[0].gate,
640 ndev->hci_dev->init_data.gates[0].pipe); 640 ndev->hci_dev->init_data.gates[0].pipe);
641 if (r < 0) 641 if (r < 0)
642 goto exit; 642 return r;
643 643
644 r = nci_hci_get_param(ndev, NCI_HCI_ADMIN_GATE, 644 r = nci_hci_get_param(ndev, NCI_HCI_ADMIN_GATE,
645 NCI_HCI_ADMIN_PARAM_SESSION_IDENTITY, &skb); 645 NCI_HCI_ADMIN_PARAM_SESSION_IDENTITY, &skb);
646 if (r < 0) 646 if (r < 0)
647 goto exit; 647 return r;
648 648
649 if (skb->len && 649 if (skb->len &&
650 skb->len == strlen(ndev->hci_dev->init_data.session_id) && 650 skb->len == strlen(ndev->hci_dev->init_data.session_id) &&
651 memcmp(ndev->hci_dev->init_data.session_id, 651 !memcmp(ndev->hci_dev->init_data.session_id, skb->data, skb->len) &&
652 skb->data, skb->len) == 0 &&
653 ndev->ops->hci_load_session) { 652 ndev->ops->hci_load_session) {
654 /* Restore gate<->pipe table from some proprietary location. */ 653 /* Restore gate<->pipe table from some proprietary location. */
655 r = ndev->ops->hci_load_session(ndev); 654 r = ndev->ops->hci_load_session(ndev);
656 if (r < 0)
657 goto exit;
658 } else { 655 } else {
659 r = nci_hci_dev_connect_gates(ndev, 656 r = nci_hci_dev_connect_gates(ndev,
660 ndev->hci_dev->init_data.gate_count, 657 ndev->hci_dev->init_data.gate_count,
@@ -667,8 +664,6 @@ int nci_hci_dev_session_init(struct nci_dev *ndev)
667 ndev->hci_dev->init_data.session_id, 664 ndev->hci_dev->init_data.session_id,
668 strlen(ndev->hci_dev->init_data.session_id)); 665 strlen(ndev->hci_dev->init_data.session_id));
669 } 666 }
670 if (r == 0)
671 goto exit;
672 667
673exit: 668exit:
674 kfree_skb(skb); 669 kfree_skb(skb);