On Mon, 19 Oct 2020 01:59:19 +0000 zhudi (J) wrote: > > zhudi, why not use size_t? Seems like the most natural fit for counting > > size. > > Thanks for your replying. > min_dump_alloc original type used is u16 and it's eventually assigned to > struct netlink_callback{}. min_dump_alloc which data type is u32. So I just > simply > promote to u32. > Should be used size_t instead of u32?
I had a closer look, and I agree that u32 should be fine in struct netlink_dump_control, rtnetlink_rcv_msg(), and as a return value from rtnl_calcit(). But please use size_t for the local variable in rtnl_calcit(). This way you can convert the max_t() to a max(). When you send v2 please move the declaration of min_ifinfo_dump_size after struct net *net = sock_net(skb->sk); (to get closer to longest to shortest declaration order).