Re: [PATCH nf-next 1/3] netfilter: nf_tables: add userdata attributes to nft_table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 21/8/20 19:21, Pablo Neira Ayuso wrote:
        if (nla[NFTA_TABLE_USERDATA]) {
                udlen = nla_len(nla[NFTA_TABLE_USERDATA]);
                table->udata = kzalloc(udlen, GFP_KERNEL);
                if (table->udata == NULL)
                        goto err_table_udata;

                nla_memcpy(table->udata, nla[NFTA_TABLE_USERDATA], udlen);
                table->udlen = udlen;
        }

Probably this simplification instead? kzalloc() zeroes the table
object, so table->udata is NULL and ->udlen is zero.

I see. The reason why I didn't simplify at first was because when using other nf_tables_new* functions with userdata support as reference (like newset or newrule), these are checking for userdata length obtained via nla_len before calling nla_memcpy.




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux