diff options
author | Alex Elder <elder@linaro.org> | 2022-10-21 22:13:37 +0300 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2022-10-25 12:15:18 +0300 |
commit | 5444b0ea9915132b8a202c2c664630cb99daa969 (patch) | |
tree | 37ab57055242a2a4d75fa3a4838dd0517dfc1e3c /drivers/net/ipa/ipa_cmd.c | |
parent | cf13919654d5fe54974c7bba49c220833c26bce4 (diff) | |
download | linux-5444b0ea9915132b8a202c2c664630cb99daa969.tar.xz |
net: ipa: verify table sizes fit in commands early
We currently verify the table size and offset fit in the immediate
command fields that must encode them in ipa_table_valid_one(). We
can now make this check earlier, in ipa_table_mem_valid().
The non-hashed IPv4 filter and route tables will always exist, and
their sizes will match the IPv6 tables, as well as the hashed tables
(if supported). So it's sufficient to verify the offset and size of
the IPv4 non-hashed tables fit into these fields.
Rename the function ipa_cmd_table_init_valid(), to reinforce that
it is the TABLE_INIT immediate command fields we're checking.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'drivers/net/ipa/ipa_cmd.c')
-rw-r--r-- | drivers/net/ipa/ipa_cmd.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ipa/ipa_cmd.c b/drivers/net/ipa/ipa_cmd.c index e46e8f80b174..abee6cc018a2 100644 --- a/drivers/net/ipa/ipa_cmd.c +++ b/drivers/net/ipa/ipa_cmd.c @@ -171,7 +171,8 @@ static void ipa_cmd_validate_build(void) } /* Validate a memory region holding a table */ -bool ipa_cmd_table_valid(struct ipa *ipa, const struct ipa_mem *mem, bool route) +bool ipa_cmd_table_init_valid(struct ipa *ipa, const struct ipa_mem *mem, + bool route) { u32 offset_max = field_max(IP_FLTRT_FLAGS_NHASH_ADDR_FMASK); u32 size_max = field_max(IP_FLTRT_FLAGS_NHASH_SIZE_FMASK); |