param_limit: fix read beyond end of array (segfault)
[smatch.git] / check_wait_for_common.c
blob11936df8c4c2f67d9ef0504f09da278934eba7c3
1 /*
2 * smatch/check_wait_for_common.c
4 * Copyright (C) 2011 Oracle.
6 * Licensed under the Open Software License version 1.1
8 */
10 #include "smatch.h"
12 static int my_id;
14 static void match_wait_for_common(const char *fn, struct expression *expr, void *unused)
16 char *name;
18 if (!expr_unsigned(expr->left))
19 return;
20 name = get_variable_from_expr_complex(expr->left, NULL);
21 sm_msg("error: '%s()' returns negative and '%s' is unsigned", fn, name);
22 free_string(name);
25 void check_wait_for_common(int id)
27 my_id = id;
29 if (option_project != PROJ_KERNEL)
30 return;
31 add_function_assign_hook("wait_for_common", &match_wait_for_common, NULL);
32 add_function_assign_hook("wait_for_completion_interruptible_timeout", &match_wait_for_common, NULL);