Skip to content

Commit e257144

Browse files
Asbjørn Sloth Tønnesendavem330
authored andcommitted
net: qede: sanitize 'rc' in qede_add_tc_flower_fltr()
Explicitly set 'rc' (return code), before jumping to the unlock and return path. By not having any code depend on that 'rc' remains at it's initial value of -EINVAL, then we can re-use 'rc' for the return code of function calls in subsequent patches. Only compile tested. Signed-off-by: Asbjørn Sloth Tønnesen <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 16f5030 commit e257144

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

drivers/net/ethernet/qlogic/qede/qede_filter.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,8 +1868,8 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto,
18681868
struct flow_cls_offload *f)
18691869
{
18701870
struct qede_arfs_fltr_node *n;
1871-
int min_hlen, rc = -EINVAL;
18721871
struct qede_arfs_tuple t;
1872+
int min_hlen, rc;
18731873

18741874
__qede_lock(edev);
18751875

@@ -1879,21 +1879,26 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto,
18791879
}
18801880

18811881
/* parse flower attribute and prepare filter */
1882-
if (qede_parse_flow_attr(edev, proto, f->rule, &t))
1882+
if (qede_parse_flow_attr(edev, proto, f->rule, &t)) {
1883+
rc = -EINVAL;
18831884
goto unlock;
1885+
}
18841886

18851887
/* Validate profile mode and number of filters */
18861888
if ((edev->arfs->filter_count && edev->arfs->mode != t.mode) ||
18871889
edev->arfs->filter_count == QEDE_RFS_MAX_FLTR) {
18881890
DP_NOTICE(edev,
18891891
"Filter configuration invalidated, filter mode=0x%x, configured mode=0x%x, filter count=0x%x\n",
18901892
t.mode, edev->arfs->mode, edev->arfs->filter_count);
1893+
rc = -EINVAL;
18911894
goto unlock;
18921895
}
18931896

18941897
/* parse tc actions and get the vf_id */
1895-
if (qede_parse_actions(edev, &f->rule->action, f->common.extack))
1898+
if (qede_parse_actions(edev, &f->rule->action, f->common.extack)) {
1899+
rc = -EINVAL;
18961900
goto unlock;
1901+
}
18971902

18981903
if (qede_flow_find_fltr(edev, &t)) {
18991904
rc = -EEXIST;

0 commit comments

Comments
 (0)