From fab1dd9c1813746cf229d49ebb63cc427fea62c2 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 16 May 2012 15:42:58 +0300 Subject: [PATCH] cleanup: use valid_ptr_min/max. get rid of POINTER_MAX These were two different variables for the same thing. Signed-off-by: Dan Carpenter --- check_held_dev.c | 4 ++-- check_kernel.c | 2 +- check_locking.c | 2 +- check_return_enomem.c | 6 +++--- check_unwind.c | 8 ++++---- smatch.h | 2 -- 6 files changed, 11 insertions(+), 13 deletions(-) diff --git a/check_held_dev.c b/check_held_dev.c index 2738928f..2245e8d4 100644 --- a/check_held_dev.c +++ b/check_held_dev.c @@ -106,8 +106,8 @@ static void register_returns_held_funcs(void) if (token_type(token) != TOKEN_IDENT) return; func = show_ident(token->ident); - return_implies_state(func, 1, POINTER_MAX, &match_returns_held, - NULL); + return_implies_state(func, valid_ptr_min, valid_ptr_max, + &match_returns_held, NULL); return_implies_state(func, 0, 0, &match_returns_null, NULL); token = token->next; diff --git a/check_kernel.c b/check_kernel.c index 2ba37a52..8b6d45f8 100644 --- a/check_kernel.c +++ b/check_kernel.c @@ -45,7 +45,7 @@ static void match_param_nonnull(const char *fn, struct expression *call_expr, static void match_container_of(const char *fn, struct expression *expr, void *unused) { - set_extra_expr_mod(expr->left, alloc_estate_range(1, POINTER_MAX)); + set_extra_expr_mod(expr->left, alloc_estate_range(valid_ptr_min, valid_ptr_max)); } void check_kernel(int id) diff --git a/check_locking.c b/check_locking.c index 0414cb63..00b80911 100644 --- a/check_locking.c +++ b/check_locking.c @@ -730,7 +730,7 @@ static void register_lock(int index) void *idx = INT_PTR(index); if (lock->return_type == ret_non_zero) { - return_implies_state(lock->function, 1, POINTER_MAX, &match_lock_held, idx); + return_implies_state(lock->function, valid_ptr_min, valid_ptr_max, &match_lock_held, idx); return_implies_state(lock->function, 0, 0, &match_lock_failed, idx); } else if (lock->return_type == ret_any && lock->arg == RETURN_VAL) { add_function_assign_hook(lock->function, &match_returns_locked, idx); diff --git a/check_return_enomem.c b/check_return_enomem.c index 24c16e07..dc7e24ac 100644 --- a/check_return_enomem.c +++ b/check_return_enomem.c @@ -76,11 +76,11 @@ void check_return_enomem(int id) return; my_id = id; - return_implies_state("kmalloc", 1, POINTER_MAX, &allocation_succeeded, INT_PTR(0)); + return_implies_state("kmalloc", valid_ptr_min, valid_ptr_max, &allocation_succeeded, INT_PTR(0)); return_implies_state("kmalloc", 0, 0, &allocation_failed, INT_PTR(0)); - return_implies_state("kzalloc", 1, POINTER_MAX, &allocation_succeeded, INT_PTR(0)); + return_implies_state("kzalloc", valid_ptr_min, valid_ptr_max, &allocation_succeeded, INT_PTR(0)); return_implies_state("kzalloc", 0, 0, &allocation_failed, INT_PTR(0)); - return_implies_state("kcalloc", 1, POINTER_MAX, &allocation_succeeded, INT_PTR(0)); + return_implies_state("kcalloc", valid_ptr_min, valid_ptr_max, &allocation_succeeded, INT_PTR(0)); return_implies_state("kcalloc", 0, 0, &allocation_failed, INT_PTR(0)); add_hook(&match_return, RETURN_HOOK); set_default_modification_hook(my_id, ok_to_use); diff --git a/check_unwind.c b/check_unwind.c index 8765b14b..11b901ff 100644 --- a/check_unwind.c +++ b/check_unwind.c @@ -181,21 +181,21 @@ void check_unwind(int id) add_function_hook("release_resource", &match_release, INT_PTR(0)); release_function_indicator("release_resource"); - return_implies_state("__request_region", 1, POINTER_MAX, &request_granted, INT_PTR(1)); + return_implies_state("__request_region", valid_ptr_min, valid_ptr_max, &request_granted, INT_PTR(1)); return_implies_state("__request_region", 0, 0, &request_denied, INT_PTR(1)); add_function_hook("__release_region", &match_release, INT_PTR(1)); release_function_indicator("__release_region"); - return_implies_state("ioremap", 1, POINTER_MAX, &request_granted, INT_PTR(-1)); + return_implies_state("ioremap", valid_ptr_min, valid_ptr_max, &request_granted, INT_PTR(-1)); return_implies_state("ioremap", 0, 0, &request_denied, INT_PTR(-1)); add_function_hook("iounmap", &match_release, INT_PTR(0)); - return_implies_state("pci_iomap", 1, POINTER_MAX, &request_granted, INT_PTR(-1)); + return_implies_state("pci_iomap", valid_ptr_min, valid_ptr_max, &request_granted, INT_PTR(-1)); return_implies_state("pci_iomap", 0, 0, &request_denied, INT_PTR(-1)); add_function_hook("pci_iounmap", &match_release, INT_PTR(1)); release_function_indicator("pci_iounmap"); - return_implies_state("__create_workqueue_key", 1, POINTER_MAX, &request_granted, + return_implies_state("__create_workqueue_key", valid_ptr_min, valid_ptr_max, &request_granted, INT_PTR(-1)); return_implies_state("__create_workqueue_key", 0, 0, &request_denied, INT_PTR(-1)); add_function_hook("destroy_workqueue", &match_release, INT_PTR(0)); diff --git a/smatch.h b/smatch.h index a58edc95..27d3e490 100644 --- a/smatch.h +++ b/smatch.h @@ -174,8 +174,6 @@ static inline void print_implied_debug_msg() } \ } while(0) -#define POINTER_MAX 0xffffffff - struct smatch_state *get_state(int owner, const char *name, struct symbol *sym); struct smatch_state *get_state_expr(int owner, struct expression *expr); struct state_list *get_possible_states(int owner, const char *name, -- 2.11.4.GIT