Struct netlink_callback has a 48byte scratch area for use by dump callbacks to keep personal stuff. In rule dumps set up by nf_tables_getrule(), this is used only to store a cursor into the list of rules being dumped. Other data is allocated and the pointer value assigned to struct netlink_callback::data. Since the allocated data structure is small and fits into the scratch area even after adding some more fields, move it there. Patch 1 "simplifies" nf_tables_dump_rules_start() a bit, but actually exists only to reduce patch 5's size. Patch 2 is more or less fallout: The memset would mess things up after this series, but it was pointless in the first place. Patches 3 and 4 extend struct nft_rule_dump_ctx and make struct netlink_callback's scratch area unused. Patch 5 then finally eliminates the allocation. All this is early preparation for reset command locking but unrelated enough to go alone. Phil Sutter (5): netfilter: nf_tables: Always allocate nft_rule_dump_ctx netfilter: nf_tables: Drop pointless memset when dumping rules netfilter: nf_tables: Carry reset flag in nft_rule_dump_ctx netfilter: nf_tables: Carry s_idx in nft_rule_dump_ctx netfilter: nf_tables: Don't allocate nft_rule_dump_ctx net/netfilter/nf_tables_api.c | 80 ++++++++++++++--------------------- 1 file changed, 31 insertions(+), 49 deletions(-) -- 2.41.0