net: ipa: verify table sizes fit in commands early
authorAlex Elder <elder@linaro.org>
Fri, 21 Oct 2022 19:13:37 +0000 (14:13 -0500)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 25 Oct 2022 09:15:18 +0000 (11:15 +0200)
commit5444b0ea9915132b8a202c2c664630cb99daa969
tree37ab57055242a2a4d75fa3a4838dd0517dfc1e3c
parentcf13919654d5fe54974c7bba49c220833c26bce4
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>
drivers/net/ipa/ipa_cmd.c
drivers/net/ipa/ipa_cmd.h
drivers/net/ipa/ipa_table.c