diff --git a/lib/cache_mngt.c b/lib/cache_mngt.c index 9f8a742..8ed2129 100644 --- a/lib/cache_mngt.c +++ b/lib/cache_mngt.c @@ -254,6 +254,9 @@ int nl_cache_mngt_register(struct nl_cache_ops *ops) if (!ops->co_name || !ops->co_obj_ops) return -NLE_INVAL; + /* oo_keygen() also needs oo_compare() */ + BUG_ON (ops->co_obj_ops->oo_keygen && !ops->co_obj_ops->oo_compare); + nl_write_lock(&cache_ops_lock); if (__nl_cache_ops_lookup(ops->co_name)) { nl_write_unlock(&cache_ops_lock);