4 * Copyright (C) 2009 Dan Carpenter.
6 * Licensed under the Open Software License version 1.1
14 static void match_free(const char *fn
, struct expression
*expr
, void *data
)
16 struct expression
*arg_expr
;
20 arg_expr
= get_argument_from_call_expr(expr
->args
, 0);
21 type
= get_type(arg_expr
);
22 if (!type
|| type
->type
!= SYM_PTR
)
24 type
= get_base_type(type
);
25 if (!type
|| !type
->ident
|| strcmp("sk_buff", type
->ident
->name
))
27 name
= get_variable_from_expr_complex(arg_expr
, NULL
);
28 sm_msg("error: use kfree_skb() here instead of kfree(%s)", name
);
32 void check_type(int id
)
35 if (option_project
== PROJ_KERNEL
)
36 add_function_hook("kfree", &match_free
, NULL
);