diff options
Diffstat (limited to 'drivers/net/gianfar_ethtool.c')
-rw-r--r-- | drivers/net/gianfar_ethtool.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c index 6e350692d118..0caf3c323ec0 100644 --- a/drivers/net/gianfar_ethtool.c +++ b/drivers/net/gianfar_ethtool.c | |||
@@ -686,10 +686,21 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u | |||
686 | { | 686 | { |
687 | unsigned int last_rule_idx = priv->cur_filer_idx; | 687 | unsigned int last_rule_idx = priv->cur_filer_idx; |
688 | unsigned int cmp_rqfpr; | 688 | unsigned int cmp_rqfpr; |
689 | unsigned int local_rqfpr[MAX_FILER_IDX + 1]; | 689 | unsigned int *local_rqfpr; |
690 | unsigned int local_rqfcr[MAX_FILER_IDX + 1]; | 690 | unsigned int *local_rqfcr; |
691 | int i = 0x0, k = 0x0; | 691 | int i = 0x0, k = 0x0; |
692 | int j = MAX_FILER_IDX, l = 0x0; | 692 | int j = MAX_FILER_IDX, l = 0x0; |
693 | int ret = 1; | ||
694 | |||
695 | local_rqfpr = kmalloc(sizeof(unsigned int) * (MAX_FILER_IDX + 1), | ||
696 | GFP_KERNEL); | ||
697 | local_rqfcr = kmalloc(sizeof(unsigned int) * (MAX_FILER_IDX + 1), | ||
698 | GFP_KERNEL); | ||
699 | if (!local_rqfpr || !local_rqfcr) { | ||
700 | pr_err("Out of memory\n"); | ||
701 | ret = 0; | ||
702 | goto err; | ||
703 | } | ||
693 | 704 | ||
694 | switch (class) { | 705 | switch (class) { |
695 | case TCP_V4_FLOW: | 706 | case TCP_V4_FLOW: |
@@ -706,7 +717,8 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u | |||
706 | break; | 717 | break; |
707 | default: | 718 | default: |
708 | pr_err("Right now this class is not supported\n"); | 719 | pr_err("Right now this class is not supported\n"); |
709 | return 0; | 720 | ret = 0; |
721 | goto err; | ||
710 | } | 722 | } |
711 | 723 | ||
712 | for (i = 0; i < MAX_FILER_IDX + 1; i++) { | 724 | for (i = 0; i < MAX_FILER_IDX + 1; i++) { |
@@ -721,7 +733,8 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u | |||
721 | 733 | ||
722 | if (i == MAX_FILER_IDX + 1) { | 734 | if (i == MAX_FILER_IDX + 1) { |
723 | pr_err("No parse rule found, can't create hash rules\n"); | 735 | pr_err("No parse rule found, can't create hash rules\n"); |
724 | return 0; | 736 | ret = 0; |
737 | goto err; | ||
725 | } | 738 | } |
726 | 739 | ||
727 | /* If a match was found, then it begins the starting of a cluster rule | 740 | /* If a match was found, then it begins the starting of a cluster rule |
@@ -765,7 +778,10 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u | |||
765 | priv->cur_filer_idx = priv->cur_filer_idx - 1; | 778 | priv->cur_filer_idx = priv->cur_filer_idx - 1; |
766 | } | 779 | } |
767 | 780 | ||
768 | return 1; | 781 | err: |
782 | kfree(local_rqfcr); | ||
783 | kfree(local_rqfpr); | ||
784 | return ret; | ||
769 | } | 785 | } |
770 | 786 | ||
771 | static int gfar_set_hash_opts(struct gfar_private *priv, struct ethtool_rxnfc *cmd) | 787 | static int gfar_set_hash_opts(struct gfar_private *priv, struct ethtool_rxnfc *cmd) |
@@ -1653,10 +1669,10 @@ static int gfar_get_cls_all(struct gfar_private *priv, | |||
1653 | u32 i = 0; | 1669 | u32 i = 0; |
1654 | 1670 | ||
1655 | list_for_each_entry(comp, &priv->rx_list.list, list) { | 1671 | list_for_each_entry(comp, &priv->rx_list.list, list) { |
1656 | if (i <= cmd->rule_cnt) { | 1672 | if (i == cmd->rule_cnt) |
1657 | rule_locs[i] = comp->fs.location; | 1673 | return -EMSGSIZE; |
1658 | i++; | 1674 | rule_locs[i] = comp->fs.location; |
1659 | } | 1675 | i++; |
1660 | } | 1676 | } |
1661 | 1677 | ||
1662 | cmd->data = MAX_FILER_IDX; | 1678 | cmd->data = MAX_FILER_IDX; |