On Thu, 2021-09-16 at 20:05 +0800, liqiong wrote: > Hi Mini, > > I got this sparse warnings, should i fix it ? > > It seems the follow patch can fix, but i don't think should do > this check (ima_rules_tmp == NULL). > > > -static struct list_head *ima_rules = &ima_default_rules; > +static struct list_head __rcu *ima_rules = (struct list_head __rcu *)(&ima_default_rules); > > ima_rules_tmp = rcu_dereference(ima_rules); > +if (ima_rules_tmp == NULL) > + return ; Agreed, the "__rcu" annotation is missing. Probably both ima_rules and ima_rules_tmp should be annotated with "__rcu". Agreed, ima_rules_tmp will either point to the default or custom policy rules. No need for the check. Please post a new version of the patch, with "Reported-by: kernel test robot <lkp@xxxxxxxxx> (Fix sparse: incompatible types in comparison expression)". thanks, Mimi