On 10/18/23 19:28, Martin KaFai Lau wrote:
On 10/17/23 9:22 AM, thinker.li@xxxxxxxxx wrote:
+const struct bpf_struct_ops **btf_get_struct_ops(struct btf *btf, u32
*ret_cnt)
+{
+ if (!btf)
+ return NULL;
+ if (!btf->struct_ops_tab)
+ return NULL;
+
+ *ret_cnt = btf->struct_ops_tab->cnt;
+ return (const struct bpf_struct_ops **)btf->struct_ops_tab->ops;
Is it possible that the module is already gone here? If that is the
case, the st_ops pointer probably cannot be used?
The callers should call bpf_try_get_module() before calling this
function. I will check the code to ensure all callers do that in
the next version.