Skip to contentSkip to conversation

rethook: Add a generic return hook

bug report Dan Carpenter 1 participant 1 message Nov 15, 2022 Kernel janitors

lore
Share & tools
lore
#0 lore raw

Hello Masami Hiramatsu,

The patch 54ecbe6f1ed5: "rethook: Add a generic return hook" from Mar 15, 2022, leads to the following Smatch static checker warning:

kernel/trace/rethook.c:92 rethook_alloc()
warn: use 'gfp' here instead of GFP_XXX?

kernel/trace/rethook.c
89 struct rethook *rethook_alloc(void *data, rethook_handler_t handler, gfp_t gfp,
90 int size, int max)
91 {
--> 92 struct rethook *rh = kzalloc(sizeof(struct rethook), GFP_KERNEL);

"gfp" is always GFP_KERNEL so this doesn't affect runtime.

    93 
    94         if (!rh || !handler)
    95                 return NULL;
    96 
    97         rh->data = data;
    98         rh->handler = handler;
    99 
    100         /* initialize the objpool for rethook nodes */
    101         if (objpool_init(&rh->pool, max, max, size, gfp, rh, rethook_init_node,
    102                         NULL)) {
    103                 kfree(rh);
    104                 return NULL;
    105         }
    106         refcount_set(&rh->ref, max + 1);
    107         return rh;
    108 }

regards,
dan carpenter