<div dir="ltr"><div>On 03/11 05:02, Dmitry V. Levin wrote:</div><div>> On Sun, Mar 11, 2018 at 09:43:53AM +0800, Chen Jingpiao wrote:</div><div>> > On 03/11 03:48, Dmitry V. Levin wrote:</div><div>> [...]</div><div>> > > In other words, NFNL_SUBSYS_COUNT provided by kernel headers is unreliable</div><div>> > > and shouldn't be used, I think it has to be removed from</div><div>> > > xlat/<a href="http://nl_netfilter_subsys_ids.in">nl_netfilter_subsys_ids.in</a> as well.</div><div>> > </div><div>> > I can not find an existing way to remove the condition from xlat/*.h.</div><div>> > xlat/gen.sh only have print_xlat and cond_xlat to generate xlat array.</div><div>> > Should I add a directive?</div><div>> </div><div>> Well, you can simply write</div><div>> </div><div>> #undef NFNL_SUBSYS_COUNT</div><div>> #define NFNL_SUBSYS_COUNT       12</div><div>> NFNL_SUBSYS_COUNT</div><div>> </div><div>> but NFNL_SUBSYS_COUNT is not a symbol with some constant value: it changes</div><div>> with time, so what's the use of printing it in symbolic form?</div><div><br></div><div>If we want to print it well in symbolic form, we should use kernel headers'</div><div>NFNL_SUBSYS_COUNT value, and move it to the first line.</div><div>What do you think?</div><div><br></div><div>> </div><div>> > ps:</div><div>> > Is the same problem exist in other counter symbols in xlat/*.in?</div><div>> > (I do the research, not found.)</div><div>> </div><div>> I haven't investigated it.  We might have more issues of this nature,</div><div>> but if we do, then they are not covered by tests.</div><div>> </div><div>> > > For netlink_netfilter.c purposes I'd recommend to use something like</div><div>> > > (subsys_id > nl_netfilter_subsys_ids[ARRAY_SIZE(nl_netfilter_subsys_ids)</div><div>> > - 1].val)</div><div>> > > instead of subsys_id >= NFNL_SUBSYS_COUNT).</div><div>> > </div><div>> > If I have removed kernel header's NFNL_SUBSYS_COUNT value from</div><div>> > xlat/<a href="http://nl_netfilter_subsys_ids.in">nl_netfilter_subsys_ids.in</a>.</div><div>> > Why can't we use subsys_id >= NFNL_SUBSYS_COUNT?</div><div>> </div><div>> I wonder whether it's a good idea to check against NFNL_SUBSYS_COUNT?</div><div>> Wouldn't it be more future-proof to invoke decode_nlattr for any</div><div>> subsys_id?</div><div><br></div><div>Ok.</div><div><br></div><div>--</div><div>Chen Jingpiao</div></div>