mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:46:16 +00:00
fib: remove unnecessary input parameters in fib_default_rule_add
When fib_default_rule_add is invoked, the value of the input parameter 'flags' is always 0. Rules uses kzalloc to allocate memory, so 'flags' has been initialized to 0. Therefore, remove the input parameter 'flags' in fib_default_rule_add. Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://lore.kernel.org/r/20240102071519.3781384-1-shaozhengchao@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
5fe65375e3
commit
b4c1d4d973
@ -172,8 +172,7 @@ void fib_rules_unregister(struct fib_rules_ops *);
|
||||
|
||||
int fib_rules_lookup(struct fib_rules_ops *, struct flowi *, int flags,
|
||||
struct fib_lookup_arg *);
|
||||
int fib_default_rule_add(struct fib_rules_ops *, u32 pref, u32 table,
|
||||
u32 flags);
|
||||
int fib_default_rule_add(struct fib_rules_ops *, u32 pref, u32 table);
|
||||
bool fib_rule_matchall(const struct fib_rule *rule);
|
||||
int fib_rules_dump(struct net *net, struct notifier_block *nb, int family,
|
||||
struct netlink_ext_ack *extack);
|
||||
|
@ -53,7 +53,7 @@ bool fib_rule_matchall(const struct fib_rule *rule)
|
||||
EXPORT_SYMBOL_GPL(fib_rule_matchall);
|
||||
|
||||
int fib_default_rule_add(struct fib_rules_ops *ops,
|
||||
u32 pref, u32 table, u32 flags)
|
||||
u32 pref, u32 table)
|
||||
{
|
||||
struct fib_rule *r;
|
||||
|
||||
@ -65,7 +65,6 @@ int fib_default_rule_add(struct fib_rules_ops *ops,
|
||||
r->action = FR_ACT_TO_TBL;
|
||||
r->pref = pref;
|
||||
r->table = table;
|
||||
r->flags = flags;
|
||||
r->proto = RTPROT_KERNEL;
|
||||
r->fr_net = ops->fro_net;
|
||||
r->uid_range = fib_kuid_range_unset;
|
||||
|
@ -395,13 +395,13 @@ static int fib_default_rules_init(struct fib_rules_ops *ops)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = fib_default_rule_add(ops, 0, RT_TABLE_LOCAL, 0);
|
||||
err = fib_default_rule_add(ops, 0, RT_TABLE_LOCAL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = fib_default_rule_add(ops, 0x7FFE, RT_TABLE_MAIN, 0);
|
||||
err = fib_default_rule_add(ops, 0x7FFE, RT_TABLE_MAIN);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = fib_default_rule_add(ops, 0x7FFF, RT_TABLE_DEFAULT, 0);
|
||||
err = fib_default_rule_add(ops, 0x7FFF, RT_TABLE_DEFAULT);
|
||||
if (err < 0)
|
||||
return err;
|
||||
return 0;
|
||||
|
@ -253,7 +253,7 @@ static int __net_init ipmr_rules_init(struct net *net)
|
||||
goto err1;
|
||||
}
|
||||
|
||||
err = fib_default_rule_add(ops, 0x7fff, RT_TABLE_DEFAULT, 0);
|
||||
err = fib_default_rule_add(ops, 0x7fff, RT_TABLE_DEFAULT);
|
||||
if (err < 0)
|
||||
goto err2;
|
||||
|
||||
|
@ -475,11 +475,11 @@ static int __net_init fib6_rules_net_init(struct net *net)
|
||||
if (IS_ERR(ops))
|
||||
return PTR_ERR(ops);
|
||||
|
||||
err = fib_default_rule_add(ops, 0, RT6_TABLE_LOCAL, 0);
|
||||
err = fib_default_rule_add(ops, 0, RT6_TABLE_LOCAL);
|
||||
if (err)
|
||||
goto out_fib6_rules_ops;
|
||||
|
||||
err = fib_default_rule_add(ops, 0x7FFE, RT6_TABLE_MAIN, 0);
|
||||
err = fib_default_rule_add(ops, 0x7FFE, RT6_TABLE_MAIN);
|
||||
if (err)
|
||||
goto out_fib6_rules_ops;
|
||||
|
||||
|
@ -242,7 +242,7 @@ static int __net_init ip6mr_rules_init(struct net *net)
|
||||
goto err1;
|
||||
}
|
||||
|
||||
err = fib_default_rule_add(ops, 0x7fff, RT6_TABLE_DFLT, 0);
|
||||
err = fib_default_rule_add(ops, 0x7fff, RT6_TABLE_DFLT);
|
||||
if (err < 0)
|
||||
goto err2;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user