mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
netfilter: xtables: mark initial tables constant
The inputted table is never modified, so should be considered const. Signed-off-by: Jan Engelhardt <[email protected]> Signed-off-by: Patrick McHardy <[email protected]>
This commit is contained in:
parent
dc05a564ab
commit
35aad0ffdf
22 changed files with 42 additions and 37 deletions
|
|
@ -41,7 +41,7 @@ static int check(const struct ebt_table_info *info, unsigned int valid_hooks)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct ebt_table broute_table =
|
||||
static const struct ebt_table broute_table =
|
||||
{
|
||||
.name = "broute",
|
||||
.table = &initial_table,
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ static int check(const struct ebt_table_info *info, unsigned int valid_hooks)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct ebt_table frame_filter =
|
||||
static const struct ebt_table frame_filter =
|
||||
{
|
||||
.name = "filter",
|
||||
.table = &initial_table,
|
||||
|
|
|
|||
|
|
@ -1103,23 +1103,24 @@ free_newinfo:
|
|||
return ret;
|
||||
}
|
||||
|
||||
struct ebt_table *ebt_register_table(struct net *net, struct ebt_table *table)
|
||||
struct ebt_table *
|
||||
ebt_register_table(struct net *net, const struct ebt_table *input_table)
|
||||
{
|
||||
struct ebt_table_info *newinfo;
|
||||
struct ebt_table *t;
|
||||
struct ebt_table *t, *table;
|
||||
struct ebt_replace_kernel *repl;
|
||||
int ret, i, countersize;
|
||||
void *p;
|
||||
|
||||
if (!table || !(repl = table->table) || !repl->entries ||
|
||||
repl->entries_size == 0 ||
|
||||
repl->counters || table->private) {
|
||||
if (input_table == NULL || (repl = input_table->table) == NULL ||
|
||||
repl->entries == 0 || repl->entries_size == 0 ||
|
||||
repl->counters != NULL || input_table->private != NULL) {
|
||||
BUGPRINT("Bad table data for ebt_register_table!!!\n");
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
/* Don't add one table to multiple lists. */
|
||||
table = kmemdup(table, sizeof(struct ebt_table), GFP_KERNEL);
|
||||
table = kmemdup(input_table, sizeof(struct ebt_table), GFP_KERNEL);
|
||||
if (!table) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
|
|
|
|||
Loading…
Reference in a new issue