Signed-off-by: John Levon <levon@xxxxxxxxxxxxxxxxx> --- check_64bit_shift.c | 2 +- check_access_ok_math.c | 2 +- check_array_condition.c | 2 +- check_assign_vs_compare.c | 4 +- check_atomic_inc_dec.c | 2 +- check_bit_shift.c | 4 +- check_bogus_loop.c | 2 +- check_buffer_too_small_for_struct.c | 2 +- check_cast_assign.c | 2 +- check_container_of.c | 2 +- check_continue_vs_break.c | 2 +- check_deref_check.c | 2 +- check_dma_mapping_error.c | 2 +- check_double_checking.c | 2 +- check_free.c | 6 +-- check_free_strict.c | 8 ++-- check_freeing_devm.c | 2 +- check_freeing_null.c | 2 +- check_get_user_overflow.c | 6 +-- check_held_dev.c | 2 +- check_impossible_mask.c | 2 +- check_indenting.c | 4 +- check_info_leak.c | 2 +- check_kernel_printf.c | 76 +++++++++++++++++------------------ check_kmalloc_to_bugon.c | 2 +- check_kmalloc_wrong_size.c | 2 +- check_kunmap.c | 4 +- check_leaks.c | 4 +- check_locking.c | 4 +- check_logical_instead_of_bitwise.c | 4 +- check_macro_side_effects.c | 2 +- check_macros.c | 4 +- check_memory.c | 2 +- check_min_t.c | 2 +- check_missing_break.c | 2 +- check_mod_timer.c | 2 +- check_no_effect.c | 2 +- check_no_if_block.c | 4 +- check_off_by_one_relative.c | 4 +- check_or_vs_and.c | 10 ++--- check_platform_device_put.c | 2 +- check_pointer_math.c | 4 +- check_precedence.c | 10 ++--- check_proc_create.c | 2 +- check_readl_infinite_loops.c | 2 +- check_release_resource.c | 2 +- check_resource_size.c | 2 +- check_return.c | 2 +- check_return_cast.c | 2 +- check_return_efault.c | 4 +- check_return_enomem.c | 2 +- check_return_negative_var.c | 4 +- check_rosenberg.c | 6 +-- check_select.c | 2 +- check_shift_to_zero.c | 6 +-- check_signed.c | 12 +++--- check_signed_integer_overflow_check.c | 4 +- check_sizeof.c | 12 +++--- check_snprintf.c | 2 +- check_spectre.c | 2 +- check_stack.c | 2 +- check_strcpy_overflow.c | 2 +- check_struct_type.c | 2 +- check_template.c | 2 +- check_test_bit.c | 2 +- check_uninitialized.c | 2 +- check_unwind.c | 2 +- check_wine_WtoA.c | 2 +- check_wrong_size_arg.c | 2 +- check_zero_to_err_ptr.c | 4 +- smatch_buf_comparison.c | 4 +- smatch_flow.c | 2 +- 72 files changed, 154 insertions(+), 154 deletions(-) diff --git a/check_64bit_shift.c b/check_64bit_shift.c index 8cc3078e..89b1c23d 100644 --- a/check_64bit_shift.c +++ b/check_64bit_shift.c @@ -54,7 +54,7 @@ static void match_shift_assignment(struct expression *expr) } name = expr_to_str_sym(right, NULL); - sm_msg("warn: should '%s' be a 64 bit type?", name); + sm_warning("should '%s' be a 64 bit type?", name); free_string(name); } diff --git a/check_access_ok_math.c b/check_access_ok_math.c index 7db79ea2..7cfcdc4a 100644 --- a/check_access_ok_math.c +++ b/check_access_ok_math.c @@ -60,7 +60,7 @@ static void match_size(struct expression *size_expr) return; name = expr_to_str(size_expr); - sm_msg("warn: math in access_ok() is dangerous '%s'", name); + sm_warning("math in access_ok() is dangerous '%s'", name); free_string(name); } diff --git a/check_array_condition.c b/check_array_condition.c index 3d69f6d0..7b900710 100644 --- a/check_array_condition.c +++ b/check_array_condition.c @@ -41,7 +41,7 @@ static void match_condition(struct expression *expr) return; str = expr_to_str(expr); - sm_msg("warn: this array is probably non-NULL. '%s'", str); + sm_warning("this array is probably non-NULL. '%s'", str); free_string(str); } diff --git a/check_assign_vs_compare.c b/check_assign_vs_compare.c index 59006333..c6b07533 100644 --- a/check_assign_vs_compare.c +++ b/check_assign_vs_compare.c @@ -25,7 +25,7 @@ static void check_constant(struct expression *expr) if (!get_value(expr->right, &val)) return; - sm_msg("warn: was '== %s' instead of '='", sval_to_str(val)); + sm_warning("was '== %s' instead of '='", sval_to_str(val)); } static void check_address(struct expression *expr) @@ -44,7 +44,7 @@ static void check_address(struct expression *expr) return; str = expr_to_str(right); - sm_msg("warn: was '== %s' instead of '='", str); + sm_warning("was '== %s' instead of '='", str); free_string(str); } diff --git a/check_atomic_inc_dec.c b/check_atomic_inc_dec.c index f0281126..a7c5ae72 100644 --- a/check_atomic_inc_dec.c +++ b/check_atomic_inc_dec.c @@ -186,7 +186,7 @@ static void check_counter(const char *name, struct symbol *sym) if (inc_buckets[NEGATIVE] && inc_buckets[ZERO]) { - // sm_msg("warn: XXX '%s' not decremented on lines: %s.", name, show_rl(inc_lines)); + // sm_warning("XXX '%s' not decremented on lines: %s.", name, show_rl(inc_lines)); } } diff --git a/check_bit_shift.c b/check_bit_shift.c index 87f29c34..fe4ecee3 100644 --- a/check_bit_shift.c +++ b/check_bit_shift.c @@ -63,7 +63,7 @@ static void match_assign(struct expression *expr) if (!name) return; - sm_msg("warn: '%s' is a shifter (not for '%s').", + sm_warning("'%s' is a shifter (not for '%s').", name, show_special(expr->op)); } @@ -79,7 +79,7 @@ static void match_binop(struct expression *expr) if (!name) return; - sm_msg("warn: bit shifter '%s' used for logical '%s'", + sm_warning("bit shifter '%s' used for logical '%s'", name, show_special(expr->op)); } diff --git a/check_bogus_loop.c b/check_bogus_loop.c index 52ba8329..44d5ace2 100644 --- a/check_bogus_loop.c +++ b/check_bogus_loop.c @@ -81,7 +81,7 @@ static void match_loop(struct statement *stmt) goto free; if (implied_condition_false(stmt->iterator_pre_condition)) - sm_msg("warn: we never enter this loop"); + sm_warning("we never enter this loop"); free: free_string(iter_set); diff --git a/check_buffer_too_small_for_struct.c b/check_buffer_too_small_for_struct.c index e741fbd5..06b69d89 100644 --- a/check_buffer_too_small_for_struct.c +++ b/check_buffer_too_small_for_struct.c @@ -88,7 +88,7 @@ static void match_dereferences(struct expression *expr) return; name = expr_to_str(right); - sm_msg("warn: is '%s' large enough for 'struct %s'? %s", name, left_type->ident ? left_type->ident->name : "<anon>", sval_to_str(min_size)); + sm_warning("is '%s' large enough for 'struct %s'? %s", name, left_type->ident ? left_type->ident->name : "<anon>", sval_to_str(min_size)); free_string(name); set_state_expr(my_id, expr, &undefined); } diff --git a/check_cast_assign.c b/check_cast_assign.c index d1fe55ec..589b6d46 100644 --- a/check_cast_assign.c +++ b/check_cast_assign.c @@ -49,7 +49,7 @@ static void match_overflow(struct expression *expr) return; if (data_size >= cast_size) return; - sm_msg("warn: potential memory corrupting cast %d vs %d bytes", + sm_warning("potential memory corrupting cast %d vs %d bytes", cast_size, data_size); } diff --git a/check_container_of.c b/check_container_of.c index a466739d..411c9874 100644 --- a/check_container_of.c +++ b/check_container_of.c @@ -49,7 +49,7 @@ static void match_condition(struct expression *expr) char *name; name = expr_to_var(expr); - sm_msg("warn: can '%s' even be NULL?", name); + sm_warning("can '%s' even be NULL?", name); set_state_expr(my_id, expr, &undefined); free_string(name); } diff --git a/check_continue_vs_break.c b/check_continue_vs_break.c index e27d40af..c22ce0ed 100644 --- a/check_continue_vs_break.c +++ b/check_continue_vs_break.c @@ -113,7 +113,7 @@ static void match_continue(struct statement *stmt) return; if (loop_is_macro()) return; - sm_msg("warn: continue to end of do { ... } while(0); loop"); + sm_warning("continue to end of do { ... } while(0); loop"); } void check_continue_vs_break(int id) diff --git a/check_deref_check.c b/check_deref_check.c index 5d5f5144..a06cc8bd 100644 --- a/check_deref_check.c +++ b/check_deref_check.c @@ -80,7 +80,7 @@ static void match_condition(struct expression *expr) if (!sm || sm->state != &derefed) return; - sm_msg("warn: variable dereferenced before check '%s' (see line %d)", sm->name, sm->line); + sm_warning("variable dereferenced before check '%s' (see line %d)", sm->name, sm->line); set_state_expr(my_id, expr, &undefined); } diff --git a/check_dma_mapping_error.c b/check_dma_mapping_error.c index 5316c381..a786813c 100644 --- a/check_dma_mapping_error.c +++ b/check_dma_mapping_error.c @@ -61,7 +61,7 @@ static void match_return(struct expression *ret_value) return; if (min.value == 0) return; - sm_msg("warn: warn: dma_mapping_error() doesn't return an error code"); + sm_warning("dma_mapping_error() doesn't return an error code"); } void check_dma_mapping_error(int id) diff --git a/check_double_checking.c b/check_double_checking.c index 24d08097..83d10fd1 100644 --- a/check_double_checking.c +++ b/check_double_checking.c @@ -215,7 +215,7 @@ static void match_condition(struct expression *expr) return; name = expr_to_str(expr); - sm_msg("warn: we tested '%s' before and it was '%s'", name, state->name); + sm_warning("we tested '%s' before and it was '%s'", name, state->name); free_string(name); } diff --git a/check_free.c b/check_free.c index b79eed1f..9e9d835d 100644 --- a/check_free.c +++ b/check_free.c @@ -71,7 +71,7 @@ static void match_symbol(struct expression *expr) if (!is_freed(expr)) return; name = expr_to_var(expr); - sm_msg("warn: '%s' was already freed.", name); + sm_warning("'%s' was already freed.", name); free_string(name); } @@ -178,7 +178,7 @@ static void match_call(struct expression *expr) if (is_free_func(expr->fn)) sm_msg("error: double free of '%s'", name); else - sm_msg("warn: passing freed memory '%s'", name); + sm_warning("passing freed memory '%s'", name); set_state_expr(my_id, arg, &ok); free_string(name); } END_FOR_EACH_PTR(arg); @@ -199,7 +199,7 @@ static void match_return(struct expression *expr) return; name = expr_to_var(expr); - sm_msg("warn: returning freed memory '%s'", name); + sm_warning("returning freed memory '%s'", name); set_state_expr(my_id, expr, &ok); free_string(name); } diff --git a/check_free_strict.c b/check_free_strict.c index 31e33694..bf750210 100644 --- a/check_free_strict.c +++ b/check_free_strict.c @@ -71,7 +71,7 @@ static void match_symbol(struct expression *expr) if (!is_freed(expr)) return; name = expr_to_var(expr); - sm_msg("warn: '%s' was already freed.", name); + sm_warning("'%s' was already freed.", name); free_string(name); } @@ -175,7 +175,7 @@ static void match_call(struct expression *expr) if (is_free_func(expr->fn)) sm_msg("error: double free of '%s'", name); else - sm_msg("warn: passing freed memory '%s'", name); + sm_warning("passing freed memory '%s'", name); set_state_expr(my_id, arg, &ok); free_string(name); } END_FOR_EACH_PTR(arg); @@ -194,7 +194,7 @@ static void match_return(struct expression *expr) return; name = expr_to_var(expr); - sm_msg("warn: returning freed memory '%s'", name); + sm_warning("returning freed memory '%s'", name); set_state_expr(my_id, expr, &ok); free_string(name); } @@ -240,7 +240,7 @@ static void set_param_freed(struct expression *expr, int param, char *key, char if (!is_impossible_path()) { sm = get_sm_state(my_id, name, sym); if (sm && slist_has_state(sm->possible, &freed)) { - sm_msg("warn: '%s' double freed", name); + sm_warning("'%s' double freed", name); set_state(my_id, name, sym, &ok); /* fixme: doesn't silence anything. I know */ } } diff --git a/check_freeing_devm.c b/check_freeing_devm.c index f5b99372..02587bcf 100644 --- a/check_freeing_devm.c +++ b/check_freeing_devm.c @@ -36,7 +36,7 @@ static void match_free_func(const char *fn, struct expression *expr, void *_arg) if (!get_state_expr(my_id, arg_expr)) return; name = expr_to_str(arg_expr); - sm_msg("warn: passing devm_ allocated variable to kfree. '%s'", name); + sm_warning("passing devm_ allocated variable to kfree. '%s'", name); free_string(name); } diff --git a/check_freeing_null.c b/check_freeing_null.c index bd4760d2..082f6250 100644 --- a/check_freeing_null.c +++ b/check_freeing_null.c @@ -31,7 +31,7 @@ static void match_free(const char *fn, struct expression *expr, void *data) if (sval.value != 0) return; name = expr_to_var(arg_expr); - sm_msg("warn: calling %s() when '%s' is always NULL.", fn, name); + sm_warning("calling %s() when '%s' is always NULL.", fn, name); free_string(name); } diff --git a/check_get_user_overflow.c b/check_get_user_overflow.c index 31c627a2..20ec952c 100644 --- a/check_get_user_overflow.c +++ b/check_get_user_overflow.c @@ -143,11 +143,11 @@ static void check_expr(struct expression *expr) name = expr_to_var_sym(expr, NULL); if (overflow && underflow) - sm_msg("warn: check for integer over/underflow '%s'", name); + sm_warning("check for integer over/underflow '%s'", name); else if (underflow) - sm_msg("warn: check for integer underflow '%s'", name); + sm_warning("check for integer underflow '%s'", name); else - sm_msg("warn: check for integer overflow '%s'", name); + sm_warning("check for integer overflow '%s'", name); free_string(name); set_state_expr(my_max_id, expr, &capped); diff --git a/check_held_dev.c b/check_held_dev.c index bda095d3..43f61d77 100644 --- a/check_held_dev.c +++ b/check_held_dev.c @@ -71,7 +71,7 @@ static void check_for_held(void) stree = __get_cur_stree(); FOR_EACH_MY_SM(my_id, stree, tmp) { if (slist_has_state(tmp->possible, &held)) { - sm_msg("warn: '%s' held on error path.", + sm_warning("'%s' held on error path.", tmp->name); } } END_FOR_EACH_SM(tmp); diff --git a/check_impossible_mask.c b/check_impossible_mask.c index ba99870c..b33e846e 100644 --- a/check_impossible_mask.c +++ b/check_impossible_mask.c @@ -109,7 +109,7 @@ static void match_condition(struct expression *expr) return; str = expr_to_str(expr); - sm_msg("warn: masked condition '%s' is always %s.", str, + sm_warning("masked condition '%s' is always %s.", str, expr->op == SPECIAL_EQUAL ? "false" : "true"); free_string(str); } diff --git a/check_indenting.c b/check_indenting.c index 7fc2287f..76a52f82 100644 --- a/check_indenting.c +++ b/check_indenting.c @@ -61,7 +61,7 @@ static int missing_curly_braces(struct statement *stmt) if (stmt->pos.pos != inside_pos) return 0; - sm_msg("warn: curly braces intended?"); + sm_warning("curly braces intended?"); return 1; } @@ -193,7 +193,7 @@ static void match_stmt(struct statement *stmt) orig_pos = 0; return; } - sm_msg("warn: inconsistent indenting"); + sm_warning("inconsistent indenting"); orig_pos = __prev_stmt->pos.pos; } diff --git a/check_info_leak.c b/check_info_leak.c index b5431b04..4059270a 100644 --- a/check_info_leak.c +++ b/check_info_leak.c @@ -76,7 +76,7 @@ static void match_copy_to_user(const char *fn, struct expression *expr, void *un if (!sm || !slist_has_state(sm->possible, &string)) return; name = expr_to_var(src); - sm_msg("warn: possible info leak '%s'", name); + sm_warning("possible info leak '%s'", name); free_string(name); } diff --git a/check_kernel_printf.c b/check_kernel_printf.c index ecc645e7..997f89a0 100644 --- a/check_kernel_printf.c +++ b/check_kernel_printf.c @@ -191,7 +191,7 @@ qualifier: qualifier = 'H'; ++fmt; } else { - sm_msg("warn: invalid repeated qualifier '%c'", *fmt); + sm_warning("invalid repeated qualifier '%c'", *fmt); } } } @@ -201,14 +201,14 @@ qualifier: switch (*fmt) { case 'c': if (qualifier) - sm_msg("warn: qualifier '%c' ignored for %%c specifier", qualifier); + sm_warning("qualifier '%c' ignored for %%c specifier", qualifier); spec->type = FORMAT_TYPE_CHAR; return ++fmt - start; case 's': if (qualifier) - sm_msg("warn: qualifier '%c' ignored for %%s specifier", qualifier); + sm_warning("qualifier '%c' ignored for %%s specifier", qualifier); spec->type = FORMAT_TYPE_STR; return ++fmt - start; @@ -371,10 +371,10 @@ static void ip4(const char *fmt, struct symbol *type, struct symbol *basetype, i endian = ENDIAN_BIG; break; default: - sm_msg("warn: '%%p%c4' can only be followed by one of [hnbl], not '%c'", fmt[0], fmt[2]); + sm_warning("'%%p%c4' can only be followed by one of [hnbl], not '%c'", fmt[0], fmt[2]); } if (isalnum(fmt[3])) - sm_msg("warn: '%%p%c4' can only be followed by precisely one of [hnbl]", fmt[0]); + sm_warning("'%%p%c4' can only be followed by precisely one of [hnbl]", fmt[0]); } @@ -395,7 +395,7 @@ static void ip4(const char *fmt, struct symbol *type, struct symbol *basetype, i return; if (is_struct_tag(basetype, "in_addr") && endian != ENDIAN_BIG) - sm_msg("warn: passing struct in_addr* to '%%p%c4%c', is the endianness ok?", fmt[0], fmt[2]); + sm_warning("passing struct in_addr* to '%%p%c4%c', is the endianness ok?", fmt[0], fmt[2]); /* ... */ } @@ -407,11 +407,11 @@ static void ip6(const char *fmt, struct symbol *type, struct symbol *basetype, i if (isalnum(fmt[2])) { if (fmt[2] != 'c') - sm_msg("warn: '%%p%c6' can only be followed by c", fmt[0]); + sm_warning("'%%p%c6' can only be followed by c", fmt[0]); else if (fmt[0] == 'i') - sm_msg("warn: '%%pi6' does not allow flag c"); + sm_warning("'%%pi6' does not allow flag c"); if (isalnum(fmt[3])) - sm_msg("warn: '%%p%c6%c' cannot be followed by other alphanumerics", fmt[0], fmt[2]); + sm_warning("'%%p%c6%c' cannot be followed by other alphanumerics", fmt[0], fmt[2]); } if (type->ctype.modifiers & MOD_NODEREF) @@ -428,7 +428,7 @@ static void ipS(const char *fmt, struct symbol *type, struct symbol *basetype, i for (f = fmt+2; isalnum(*f); ++f) { /* It's probably too anal checking for duplicate flags. */ if (!strchr("pfschnbl", *f)) - sm_msg("warn: '%%p%cS' cannot be followed by '%c'", fmt[0], *f); + sm_warning("'%%p%cS' cannot be followed by '%c'", fmt[0], *f); } /* @@ -452,9 +452,9 @@ static void hex_string(const char *fmt, struct symbol *type, struct symbol *base assert(fmt[0] == 'h'); if (isalnum(fmt[1])) { if (!strchr("CDN", fmt[1])) - sm_msg("warn: '%%ph' cannot be followed by '%c'", fmt[1]); + sm_warning("'%%ph' cannot be followed by '%c'", fmt[1]); if (isalnum(fmt[2])) - sm_msg("warn: '%%ph' can be followed by at most one of [CDN], and no other alphanumerics"); + sm_warning("'%%ph' can be followed by at most one of [CDN], and no other alphanumerics"); } if (type->ctype.modifiers & MOD_NODEREF) sm_msg("error: passing __user pointer to %%ph"); @@ -465,7 +465,7 @@ static void escaped_string(const char *fmt, struct symbol *type, struct symbol * assert(fmt[0] == 'E'); while (isalnum(*++fmt)) { if (!strchr("achnops", *fmt)) - sm_msg("warn: %%pE can only be followed by a combination of [achnops]"); + sm_warning("%%pE can only be followed by a combination of [achnops]"); } if (type->ctype.modifiers & MOD_NODEREF) sm_msg("error: passing __user pointer to %%pE"); @@ -479,7 +479,7 @@ static void resource_string(const char *fmt, struct symbol *type, struct symbol "but argument %d has type '%s'", fmt[0], vaidx, type_to_str(type)); } if (isalnum(fmt[1])) - sm_msg("warn: '%%p%c' cannot be followed by '%c'", fmt[0], fmt[1]); + sm_warning("'%%p%c' cannot be followed by '%c'", fmt[0], fmt[1]); } static void mac_address_string(const char *fmt, struct symbol *type, struct symbol *basetype, int vaidx) @@ -487,15 +487,15 @@ static void mac_address_string(const char *fmt, struct symbol *type, struct symb assert(tolower(fmt[0]) == 'm'); if (isalnum(fmt[1])) { if (!(fmt[1] == 'F' || fmt[1] == 'R')) - sm_msg("warn: '%%p%c' cannot be followed by '%c'", fmt[0], fmt[1]); + sm_warning("'%%p%c' cannot be followed by '%c'", fmt[0], fmt[1]); if (fmt[0] == 'm' && fmt[1] == 'F') - sm_msg("warn: it is pointless to pass flag F to %%pm"); + sm_warning("it is pointless to pass flag F to %%pm"); if (isalnum(fmt[2])) - sm_msg("warn: '%%p%c%c' cannot be followed by other alphanumeric", fmt[0], fmt[1]); + sm_warning("'%%p%c%c' cannot be followed by other alphanumeric", fmt[0], fmt[1]); } /* Technically, bdaddr_t is a typedef for an anonymous struct, but this still seems to work. */ if (!is_char_type(basetype) && !is_struct_tag(basetype, "bdaddr_t") && basetype != &void_ctype) { - sm_msg("warn: '%%p%c' expects argument of type u8 * or bdaddr_t *, argument %d has type '%s'", + sm_warning("'%%p%c' expects argument of type u8 * or bdaddr_t *, argument %d has type '%s'", fmt[0], vaidx, type_to_str(type)); } if (type->ctype.modifiers & MOD_NODEREF) @@ -511,9 +511,9 @@ static void dentry_file(const char *fmt, struct symbol *type, struct symbol *bas if (isalnum(fmt[1])) { if (!strchr("234", fmt[1])) - sm_msg("warn: '%%p%c' can only be followed by one of [234]", fmt[0]); + sm_warning("'%%p%c' can only be followed by one of [234]", fmt[0]); if (isalnum(fmt[2])) - sm_msg("warn: '%%p%c%c' cannot be followed by '%c'", fmt[0], fmt[1], fmt[2]); + sm_warning("'%%p%c%c' cannot be followed by '%c'", fmt[0], fmt[1], fmt[2]); } if (!is_struct_tag(basetype, tag)) @@ -526,9 +526,9 @@ static void check_clock(const char *fmt, struct symbol *type, struct symbol *bas assert(fmt[0] == 'C'); if (isalnum(fmt[1])) { if (!strchr("nr", fmt[1])) - sm_msg("warn: '%%pC' can only be followed by one of [nr]"); + sm_warning("'%%pC' can only be followed by one of [nr]"); if (isalnum(fmt[2])) - sm_msg("warn: '%%pC%c' cannot be followed by '%c'", fmt[1], fmt[2]); + sm_warning("'%%pC%c' cannot be followed by '%c'", fmt[1], fmt[2]); } if (!is_struct_tag(basetype, "clk")) sm_msg("error: '%%pC' expects argument of type 'struct clk*', argument %d has type '%s'", @@ -539,7 +539,7 @@ static void va_format(const char *fmt, struct symbol *type, struct symbol *baset { assert(fmt[0] == 'V'); if (isalnum(fmt[1])) - sm_msg("warn: %%pV cannot be followed by any alphanumerics"); + sm_warning("%%pV cannot be followed by any alphanumerics"); if (!is_struct_tag(basetype, "va_format")) sm_msg("error: %%pV expects argument of type struct va_format*, argument %d has type '%s'", vaidx, type_to_str(type)); } @@ -554,7 +554,7 @@ static void netdev_feature(const char *fmt, struct symbol *type, struct symbol * return; } if (isalnum(fmt[2])) - sm_msg("warn: %%pNF cannot be followed by '%c'", fmt[2]); + sm_warning("%%pNF cannot be followed by '%c'", fmt[2]); typedef_lookup(&netdev); if (!netdev.sym) @@ -603,7 +603,7 @@ static void block_device(const char *fmt, struct symbol *type, struct symbol *ba assert(fmt[0] == 'g'); if (isalnum(fmt[1])) { - sm_msg("warn: %%pg cannot be followed by '%c'", fmt[1]); + sm_warning("%%pg cannot be followed by '%c'", fmt[1]); } if (!is_struct_tag(basetype, tag)) sm_msg("error: '%%p%c' expects argument of type struct '%s*', argument %d has type '%s'", @@ -655,7 +655,7 @@ pointer(const char *fmt, struct expression *arg, int vaidx) type = get_type(arg); if (!type) { - sm_msg("warn: could not determine type of argument %d", vaidx); + sm_warning("could not determine type of argument %d", vaidx); return; } if (!is_ptr_type(type)) { @@ -724,7 +724,7 @@ pointer(const char *fmt, struct expression *arg, int vaidx) ipS(fmt, type, basetype, vaidx); break; default: - sm_msg("warn: '%%p%c' must be followed by one of [46S]", fmt[0]); + sm_warning("'%%p%c' must be followed by one of [46S]", fmt[0]); break; } break; @@ -800,11 +800,11 @@ hexbyte(const char *fmt, int fmt_len, struct expression *arg, int vaidx, struct type = get_type(arg); if (!type) { - sm_msg("warn: could not determine type of argument %d", vaidx); + sm_warning("could not determine type of argument %d", vaidx); return; } if (type == &char_ctype || type == &schar_ctype) - sm_msg("warn: argument %d to %.*s specifier has type '%s'", + sm_warning("argument %d to %.*s specifier has type '%s'", vaidx, fmt_len, fmt, type_to_str(type)); } @@ -822,7 +822,7 @@ check_format_string(const char *fmt, const char *caller) * to pr_*, e.g. pr_warn(KERN_WARNING "something"). */ if (f != fmt) - sm_msg("warn: KERN_* level not at start of string"); + sm_warning("KERN_* level not at start of string"); /* * In a very few cases, the level is actually * computed and passed via %c, as in KERN_SOH @@ -833,7 +833,7 @@ check_format_string(const char *fmt, const char *caller) f[1] == 'd' || /* KERN_DEFAULT */ f[1] == 'c' || /* KERN_CONT */ (f[1] == '%' && f[2] == 'c'))) - sm_msg("warn: invalid KERN_* level: KERN_SOH_ASCII followed by '\\x%02x'", (unsigned char)f[1]); + sm_warning("invalid KERN_* level: KERN_SOH_ASCII followed by '\\x%02x'", (unsigned char)f[1]); break; case '\t': case '\n': @@ -841,14 +841,14 @@ check_format_string(const char *fmt, const char *caller) case 0x20 ... 0x7e: break; case 0x80 ... 0xff: - sm_msg("warn: format string contains non-ascii character '\\x%02x'", c); + sm_warning("format string contains non-ascii character '\\x%02x'", c); break; case 0x08: if (f == fmt) break; /* fall through */ default: - sm_msg("warn: format string contains unusual character '\\x%02x'", c); + sm_warning("format string contains unusual character '\\x%02x'", c); break; } } @@ -973,7 +973,7 @@ check_cast_from_pointer(const char *fmt, int len, struct expression *arg, int va while (is_cast_expr(arg)) arg = arg->cast_expression; if (is_ptr_type(get_final_type(arg))) - sm_msg("warn: argument %d to %.*s specifier is cast from pointer", + sm_warning("argument %d to %.*s specifier is cast from pointer", va_idx, len, fmt); } @@ -1047,10 +1047,10 @@ do_check_printf_call(const char *caller, const char *name, struct expression *ca arg = get_argument_from_call_expr(callexpr->args, vaidx++); if (spec.flags & SPECIAL && has_hex_prefix(orig_fmt, old_fmt)) - sm_msg("warn: '%.2s' prefix is redundant when # flag is used", old_fmt-2); + sm_warning("'%.2s' prefix is redundant when # flag is used", old_fmt-2); if (is_integer_specifier(spec.type)) { if (spec.base != 16 && has_hex_prefix(orig_fmt, old_fmt)) - sm_msg("warn: '%.2s' prefix is confusing together with '%.*s' specifier", + sm_warning("'%.2s' prefix is confusing together with '%.*s' specifier", old_fmt-2, (int)(fmt-old_fmt), old_fmt); check_cast_from_pointer(old_fmt, read, arg, vaidx); @@ -1098,7 +1098,7 @@ do_check_printf_call(const char *caller, const char *name, struct expression *ca spam("warn: passing __func__ while the format string already contains the name of the function '%s'", caller); else if (arg_contains_caller(arg, caller)) - sm_msg("warn: passing string constant '%s' containing '%s' which is already part of the format string", + sm_warning("passing string constant '%s' containing '%s' which is already part of the format string", arg->string->data, caller); } break; @@ -1134,7 +1134,7 @@ do_check_printf_call(const char *caller, const char *name, struct expression *ca } if (get_argument_from_call_expr(callexpr->args, vaidx)) - sm_msg("warn: excess argument passed to '%s'", name); + sm_warning("excess argument passed to '%s'", name); } diff --git a/check_kmalloc_to_bugon.c b/check_kmalloc_to_bugon.c index 0e450c73..514a4ad5 100644 --- a/check_kmalloc_to_bugon.c +++ b/check_kmalloc_to_bugon.c @@ -52,7 +52,7 @@ static void match_condition(struct expression *expr) return; name = expr_to_var(expr); - sm_msg("warn: bug on allocation failure '%s'", name); + sm_warning("bug on allocation failure '%s'", name); free_string(name); } diff --git a/check_kmalloc_wrong_size.c b/check_kmalloc_wrong_size.c index f3979f95..41e1e0e6 100644 --- a/check_kmalloc_wrong_size.c +++ b/check_kmalloc_wrong_size.c @@ -42,7 +42,7 @@ static void check_size_matches(int data_size, struct expression *size_expr) if (!get_implied_value(size_expr, &sval)) return; if (sval_cmp_val(sval, data_size) != 0) - sm_msg("warn: double check that we're allocating correct size: %d vs %s", data_size, sval_to_str(sval)); + sm_warning("double check that we're allocating correct size: %d vs %s", data_size, sval_to_str(sval)); } static void match_alloc(const char *fn, struct expression *expr, void *unused) diff --git a/check_kunmap.c b/check_kunmap.c index 68ceae45..c8ce6324 100644 --- a/check_kunmap.c +++ b/check_kunmap.c @@ -36,7 +36,7 @@ static void check_assignment(void *data) if (!fn) return; if (!strcmp(fn, "kmap")) - sm_msg("warn: passing the wrong variable to kunmap()"); + sm_warning("passing the wrong variable to kunmap()"); free_string(fn); } @@ -58,7 +58,7 @@ static void match_kunmap_atomic(const char *fn, struct expression *expr, void *d if (!sm) return; if (slist_has_state(sm->possible, &no_unmap)) - sm_msg("warn: passing the wrong variable to kmap_atomic()"); + sm_warning("passing the wrong variable to kmap_atomic()"); } static void match_kunmap(const char *fn, struct expression *expr, void *data) diff --git a/check_leaks.c b/check_leaks.c index d4f2f673..1c627a35 100644 --- a/check_leaks.c +++ b/check_leaks.c @@ -203,7 +203,7 @@ static void warn_if_allocated(struct expression *expr) return; name = expr_to_var(expr); - sm_msg("warn: overwrite may leak '%s'", name); + sm_warning("overwrite may leak '%s'", name); free_string(name); /* silence further warnings */ @@ -232,7 +232,7 @@ static void check_for_allocated(void) FOR_EACH_MY_SM(my_id, stree, tmp) { if (!slist_has_state(tmp->possible, &allocated)) continue; - sm_msg("warn: possible memory leak of '%s'", tmp->name); + sm_warning("possible memory leak of '%s'", tmp->name); } END_FOR_EACH_SM(tmp); } diff --git a/check_locking.c b/check_locking.c index c3070946..711bbc6e 100644 --- a/check_locking.c +++ b/check_locking.c @@ -617,7 +617,7 @@ static int check_possible(struct sm_state *sm) undef = 1; // i don't think this is possible any more. } END_FOR_EACH_PTR(tmp); if ((islocked && isunlocked) || undef) { - sm_msg("warn: '%s' is sometimes locked here and sometimes unlocked.", sm->name); + sm_warning("'%s' is sometimes locked here and sometimes unlocked.", sm->name); return 1; } return 0; @@ -693,7 +693,7 @@ static void print_inconsistent_returns(struct tracker *lock, struct range_list *printed = NULL; int i; - sm_msg("warn: inconsistent returns '%s'.", lock->name); + sm_warning("inconsistent returns '%s'.", lock->name); sm_printf(" Locked on: "); i = 0; diff --git a/check_logical_instead_of_bitwise.c b/check_logical_instead_of_bitwise.c index 6bb531db..39522084 100644 --- a/check_logical_instead_of_bitwise.c +++ b/check_logical_instead_of_bitwise.c @@ -49,7 +49,7 @@ static void match_logic(struct expression *expr) if (sval.value == 0 || sval.value == 1) return; - sm_msg("warn: should this be a bitwise op?"); + sm_warning("should this be a bitwise op?"); } static void match_assign(struct expression *expr) @@ -60,7 +60,7 @@ static void match_assign(struct expression *expr) if (right->type != EXPR_LOGICAL) return; if (is_bitshift(right->left) || is_bitshift(right->right)) - sm_msg("warn: should this be a bitwise op?"); + sm_warning("should this be a bitwise op?"); } void check_logical_instead_of_bitwise(int id) diff --git a/check_macro_side_effects.c b/check_macro_side_effects.c index 3ee7114c..29c92b0e 100644 --- a/check_macro_side_effects.c +++ b/check_macro_side_effects.c @@ -118,7 +118,7 @@ static void match_unop(struct expression *raw_expr) return; name = expr_to_str(raw_expr); - sm_msg("warn: side effect in macro '%s' doing '%s'", + sm_warning("side effect in macro '%s' doing '%s'", macro, name); free_string(name); } diff --git a/check_macros.c b/check_macros.c index 288356ba..8b7198e2 100644 --- a/check_macros.c +++ b/check_macros.c @@ -33,7 +33,7 @@ static void match_inside(struct expression *expr, struct position pos) name = get_macro_name(pos); if (!name) return; - sm_msg("warn: the '%s' macro might need parens", name); + sm_warning("the '%s' macro might need parens", name); } static void match_one_side(struct expression *expr, struct position pos, int op) @@ -54,7 +54,7 @@ static void match_one_side(struct expression *expr, struct position pos, int op) return; if (option_project == PROJ_WINE && !strcmp("BEGIN", name)) return; - sm_msg("warn: the '%s' macro might need parens", name); + sm_warning("the '%s' macro might need parens", name); } static void match_join(struct expression *expr) diff --git a/check_memory.c b/check_memory.c index 614e3770..776d97de 100644 --- a/check_memory.c +++ b/check_memory.c @@ -346,7 +346,7 @@ static void set_new_true_false_paths(const char *name, struct symbol *sym) } if (tmp == &isfree) { - sm_msg("warn: why do you care about freed memory? '%s'", name); + sm_warning("why do you care about freed memory? '%s'", name); } if (tmp == &assigned) { diff --git a/check_min_t.c b/check_min_t.c index 3e4ad138..9ec37f9e 100644 --- a/check_min_t.c +++ b/check_min_t.c @@ -43,7 +43,7 @@ static void match_assign(struct expression *expr) return; name = expr_to_str(expr->right); - sm_msg("warn: min_t truncates here '%s' (%s vs %s)", name, sval_to_str(max_left), sval_to_str(max_right)); + sm_warning("min_t truncates here '%s' (%s vs %s)", name, sval_to_str(max_left), sval_to_str(max_right)); free_string(name); } diff --git a/check_missing_break.c b/check_missing_break.c index 434b7283..5e6f43a9 100644 --- a/check_missing_break.c +++ b/check_missing_break.c @@ -73,7 +73,7 @@ static void print_missing_break(struct expression *expr) last_print_expr = get_switch_expr(); name = expr_to_var(expr); - sm_msg("warn: missing break? reassigning '%s'", name); + sm_warning("missing break? reassigning '%s'", name); free_string(name); } diff --git a/check_mod_timer.c b/check_mod_timer.c index 4d35f8b9..61485209 100644 --- a/check_mod_timer.c +++ b/check_mod_timer.c @@ -28,7 +28,7 @@ static void match_mod_timer(const char *fn, struct expression *expr, void *param arg = get_argument_from_call_expr(expr->args, 1); if (!get_value(arg, &sval) || sval.value == 0) return; - sm_msg("warn: mod_timer() takes an absolute time not an offset."); + sm_warning("mod_timer() takes an absolute time not an offset."); } void check_mod_timer(int id) diff --git a/check_no_effect.c b/check_no_effect.c index a159813d..f7a7ddd5 100644 --- a/check_no_effect.c +++ b/check_no_effect.c @@ -47,7 +47,7 @@ static void match_stmt(struct statement *stmt) } if (in_expression_statement()) return; - sm_msg("warn: statement has no effect %d", expr->type); + sm_warning("statement has no effect %d", expr->type); } void check_no_effect(int id) diff --git a/check_no_if_block.c b/check_no_if_block.c index b418b5d6..d3095e94 100644 --- a/check_no_if_block.c +++ b/check_no_if_block.c @@ -31,7 +31,7 @@ static void match_if_stmt(struct statement *stmt) return; if (stmt->pos.pos != stmt->if_true->pos.pos) return; - sm_msg("warn: if statement not indented"); + sm_warning("if statement not indented"); } static void match_for_stmt(struct statement *stmt) @@ -46,7 +46,7 @@ static void match_for_stmt(struct statement *stmt) return; if (stmt->pos.pos != stmt->iterator_statement->pos.pos) return; - sm_msg("warn: for statement not indented"); + sm_warning("for statement not indented"); } void check_no_if_block(int id) diff --git a/check_off_by_one_relative.c b/check_off_by_one_relative.c index e3de5c6d..f6f6e6fa 100644 --- a/check_off_by_one_relative.c +++ b/check_off_by_one_relative.c @@ -48,7 +48,7 @@ static void array_check(struct expression *expr) array_str = expr_to_str(array); offset_str = expr_to_str(offset); - sm_msg("warn: potentially one past the end of array '%s[%s]'", array_str, offset_str); + sm_warning("potentially one past the end of array '%s[%s]'", array_str, offset_str); free_string(array_str); free_string(offset_str); } @@ -138,7 +138,7 @@ static void array_check_data_info(struct expression *expr) if (equal_name) { char *array_name = expr_to_str(array); - sm_msg("warn: potential off by one '%s[]' limit '%s'", array_name, equal_name); + sm_warning("potential off by one '%s[]' limit '%s'", array_name, equal_name); free_string(array_name); } diff --git a/check_or_vs_and.c b/check_or_vs_and.c index 03df76c4..8d63c3d4 100644 --- a/check_or_vs_and.c +++ b/check_or_vs_and.c @@ -75,7 +75,7 @@ static void check_or(struct expression *expr) if (!inconsistent_check(left, right)) return; - sm_msg("warn: was && intended here instead of ||?"); + sm_warning("was && intended here instead of ||?"); } static int is_kernel_min_macro(struct expression *expr) @@ -112,7 +112,7 @@ static void check_and(struct expression *expr) if (!inconsistent_check(left, right)) return; - sm_msg("warn: was || intended here instead of &&?"); + sm_warning("was || intended here instead of &&?"); } static void match_logic(struct expression *expr) @@ -146,7 +146,7 @@ static void match_condition(struct expression *expr) return; if (expr->op == '|') { if (get_value(expr->left, &sval) || get_value(expr->right, &sval)) - sm_msg("warn: suspicious bitop condition"); + sm_warning("suspicious bitop condition"); return; } @@ -160,7 +160,7 @@ static void match_condition(struct expression *expr) if ((get_value(expr->left, &sval) && sval.value == 0) || (get_value(expr->right, &sval) && sval.value == 0)) - sm_msg("warn: bitwise AND condition is false here"); + sm_warning("bitwise AND condition is false here"); } static void match_binop(struct expression *expr) @@ -175,7 +175,7 @@ static void match_binop(struct expression *expr) return; if (!get_value(expr->left, &left) || !get_value(expr->right, &right)) return; - sm_msg("warn: odd binop '0x%llx & 0x%llx'", left.uvalue, right.uvalue); + sm_warning("odd binop '0x%llx & 0x%llx'", left.uvalue, right.uvalue); } void check_or_vs_and(int id) diff --git a/check_platform_device_put.c b/check_platform_device_put.c index 01a69b0d..bf744eb3 100644 --- a/check_platform_device_put.c +++ b/check_platform_device_put.c @@ -55,7 +55,7 @@ static void match_platform_device_del(const char *fn, struct expression *expr, v return; if (!slist_has_state(sm->possible, ¬_added)) return; - sm_msg("warn: perhaps platform_device_put() was intended here?"); + sm_warning("perhaps platform_device_put() was intended here?"); } void check_platform_device_put(int id) diff --git a/check_pointer_math.c b/check_pointer_math.c index e9afb221..d0b9a0b4 100644 --- a/check_pointer_math.c +++ b/check_pointer_math.c @@ -91,7 +91,7 @@ static void match_binop(struct expression *expr) } name = expr_to_str(expr->left); - sm_msg("warn: potential pointer math issue ('%s' is a %d bit pointer)", + sm_warning("potential pointer math issue ('%s' is a %d bit pointer)", name, type_bits(type)); free_string(name); } @@ -122,7 +122,7 @@ static void check_assign(struct expression *expr) if (!is_size_in_bytes(expr->right)) return; name = expr_to_var(expr->left); - sm_msg("warn: potential pointer math issue ('%s' is a %d bit pointer)", + sm_warning("potential pointer math issue ('%s' is a %d bit pointer)", name, type_bits(type)); free_string(name); } diff --git a/check_precedence.c b/check_precedence.c index bacbfff3..3ee06229 100644 --- a/check_precedence.c +++ b/check_precedence.c @@ -84,7 +84,7 @@ static void match_condition(struct expression *expr) } if (print) { - sm_msg("warn: add some parenthesis here?"); + sm_warning("add some parenthesis here?"); return; } @@ -96,7 +96,7 @@ static void match_condition(struct expression *expr) if (is_bool_op(expr->right)) i++; if (i == 1) - sm_msg("warn: maybe use && instead of &"); + sm_warning("maybe use && instead of &"); } } @@ -105,7 +105,7 @@ static void match_binop(struct expression *expr) if (expr->op != '&') return; if (expr->left->op == '!') - sm_msg("warn: add some parenthesis here?"); + sm_warning("add some parenthesis here?"); } static void match_mask(struct expression *expr) @@ -117,7 +117,7 @@ static void match_mask(struct expression *expr) if (expr->right->op != SPECIAL_RIGHTSHIFT) return; - sm_msg("warn: shift has higher precedence than mask"); + sm_warning("shift has higher precedence than mask"); } static void match_subtract_shift(struct expression *expr) @@ -128,7 +128,7 @@ static void match_subtract_shift(struct expression *expr) return; if (expr->right->op != '-') return; - sm_msg("warn: subtract is higher precedence than shift"); + sm_warning("subtract is higher precedence than shift"); } void check_precedence(int id) diff --git a/check_proc_create.c b/check_proc_create.c index 92e64cfa..025d2174 100644 --- a/check_proc_create.c +++ b/check_proc_create.c @@ -43,7 +43,7 @@ static void match_create(const char *fn, struct expression *expr, void *_param_t return; arg_expr = get_argument_from_call_expr(expr->args, param_index[idx].name_param); name = expr_to_var(arg_expr); - sm_msg("warn: proc file '%s' is world writable", name); + sm_warning("proc file '%s' is world writable", name); free_string(name); } diff --git a/check_readl_infinite_loops.c b/check_readl_infinite_loops.c index 23e34409..8f3ca92e 100644 --- a/check_readl_infinite_loops.c +++ b/check_readl_infinite_loops.c @@ -145,7 +145,7 @@ static void after_loop(struct statement *stmt) return; if (get_state(my_id, "depends on", NULL) != &readl_00) return; - sm_msg("warn: this loop depends on readl() succeeding"); + sm_warning("this loop depends on readl() succeeding"); } void check_readl_infinite_loops(int id) diff --git a/check_release_resource.c b/check_release_resource.c index 1c7e2abf..b6f9d626 100644 --- a/check_release_resource.c +++ b/check_release_resource.c @@ -63,7 +63,7 @@ static void match_release(const char *fn, struct expression *expr, void *_arg_no goto free; if (in_tracker_list(resource_list, my_id, name, sym)) goto free; - sm_msg("warn: '%s' was not one of the resources you requested", name); + sm_warning("'%s' was not one of the resources you requested", name); free: free_string(name); } diff --git a/check_resource_size.c b/check_resource_size.c index 3a325816..8bacb18e 100644 --- a/check_resource_size.c +++ b/check_resource_size.c @@ -42,7 +42,7 @@ static void verify_size_expr(struct expression *expr) return; if (is_probably_ok(expr->right)) return; - sm_msg("warn: consider using resource_size() here"); + sm_warning("consider using resource_size() here"); } static void handle_assigned_expr(struct expression *expr) diff --git a/check_return.c b/check_return.c index a343d2f2..3915fbe0 100644 --- a/check_return.c +++ b/check_return.c @@ -26,7 +26,7 @@ static void must_check(const char *fn, struct expression *expr, void *data) stmt = last_ptr_list((struct ptr_list *)big_statement_stack); if (stmt->type == STMT_EXPRESSION && stmt->expression == expr) - sm_msg("warn: unchecked '%s'", fn); + sm_warning("unchecked '%s'", fn); } static void register_must_check_funcs(void) diff --git a/check_return_cast.c b/check_return_cast.c index d6eca9eb..5a87a6e2 100644 --- a/check_return_cast.c +++ b/check_return_cast.c @@ -39,7 +39,7 @@ static void match_return(struct expression *ret_value) if (sval_is_positive(sval) || sval_cmp_val(sval, -1) == 0) return; - sm_msg("warn: signedness bug returning '%s'", sval_to_str(sval)); + sm_warning("signedness bug returning '%s'", sval_to_str(sval)); } void check_return_cast(int id) diff --git a/check_return_efault.c b/check_return_efault.c index 7f62467f..20cb14ea 100644 --- a/check_return_efault.c +++ b/check_return_efault.c @@ -76,7 +76,7 @@ static void match_return_var(struct expression *ret_value) return; if (min.value == 0) return; - sm_msg("warn: maybe return -EFAULT instead of the bytes remaining?"); + sm_warning("maybe return -EFAULT instead of the bytes remaining?"); } static void match_return_call(struct expression *ret_value) @@ -111,7 +111,7 @@ static void match_return_call(struct expression *ret_value) if (!sval_is_negative(rl_min(rl))) return; - sm_msg("warn: maybe return -EFAULT instead of the bytes remaining?"); + sm_warning("maybe return -EFAULT instead of the bytes remaining?"); } void check_return_efault(int id) diff --git a/check_return_enomem.c b/check_return_enomem.c index 9f8bb344..afd0f556 100644 --- a/check_return_enomem.c +++ b/check_return_enomem.c @@ -64,7 +64,7 @@ static void match_return(struct expression *ret_value) strcmp(expr->fn->symbol_name->name, "kzalloc") != 0) continue; - sm_msg("warn: returning -1 instead of -ENOMEM is sloppy"); + sm_warning("returning -1 instead of -ENOMEM is sloppy"); return; } END_FOR_EACH_SM(sm); diff --git a/check_return_negative_var.c b/check_return_negative_var.c index 03db82e1..9a18a43f 100644 --- a/check_return_negative_var.c +++ b/check_return_negative_var.c @@ -33,7 +33,7 @@ static void match_return(struct expression *ret_value) macro = get_macro_name(expr->unop->pos); if (macro && !strcmp(macro, "PTR_ERR")) { - sm_msg("warn: returning -%s()", macro); + sm_warning("returning -%s()", macro); return; } @@ -46,7 +46,7 @@ static void match_return(struct expression *ret_value) if (expr->type != EXPR_CALL) return; - sm_msg("warn: should this return really be negated?"); + sm_warning("should this return really be negated?"); } void check_return_negative_var(int id) diff --git a/check_rosenberg.c b/check_rosenberg.c index 67cf7fee..bde603a7 100644 --- a/check_rosenberg.c +++ b/check_rosenberg.c @@ -48,10 +48,10 @@ static void print_holey_warning(struct expression *data, const char *member) name = expr_to_str(data); if (member) { - sm_msg("warn: check that '%s' doesn't leak information (struct has a hole after '%s')", + sm_warning("check that '%s' doesn't leak information (struct has a hole after '%s')", name, member); } else { - sm_msg("warn: check that '%s' doesn't leak information (struct has holes)", + sm_warning("check that '%s' doesn't leak information (struct has holes)", name); } free_string(name); @@ -198,7 +198,7 @@ static int member_uninitialized(char *name, struct symbol *outer, struct symbol if (sm && !slist_has_state(sm->possible, &undefined)) return FALSE; - sm_msg("warn: check that '%s' doesn't leak information", buf); + sm_warning("check that '%s' doesn't leak information", buf); return TRUE; } diff --git a/check_select.c b/check_select.c index a32a4e4d..b9e3d1bf 100644 --- a/check_select.c +++ b/check_select.c @@ -27,7 +27,7 @@ static void match_select(struct expression *expr) expr = strip_expr(expr->conditional); if (expr->type != EXPR_COMPARE) return; - sm_msg("warn: boolean comparison inside select"); + sm_warning("boolean comparison inside select"); } void check_select(int id) diff --git a/check_shift_to_zero.c b/check_shift_to_zero.c index e8e7d903..57cc3cbb 100644 --- a/check_shift_to_zero.c +++ b/check_shift_to_zero.c @@ -35,7 +35,7 @@ static void match_binop(struct expression *expr) return; if (type_bits(type) == -1 || type_bits(type) > bits.value) return; - sm_msg("warn: right shifting more than type allows %d vs %lld", type_bits(type), bits.value); + sm_warning("right shifting more than type allows %d vs %lld", type_bits(type), bits.value); } static void match_binop2(struct expression *expr) @@ -62,7 +62,7 @@ static void match_binop2(struct expression *expr) if (mask.uvalue >> shift.uvalue) return; - sm_msg("warn: mask and shift to zero"); + sm_warning("mask and shift to zero"); } static void match_assign(struct expression *expr) @@ -80,7 +80,7 @@ static void match_assign(struct expression *expr) return; if (type_bits(type) > bits.value) return; - sm_msg("warn: right shift assign to zero"); + sm_warning("right shift assign to zero"); } void check_shift_to_zero(int id) diff --git a/check_signed.c b/check_signed.c index 85257706..d8435e9c 100644 --- a/check_signed.c +++ b/check_signed.c @@ -59,7 +59,7 @@ static void match_assign(struct expression *expr) !(sval.value < 256 && max.value == 127)) { left_name = expr_to_str(expr->left); right_name = expr_to_str(expr->right); - sm_msg("warn: '%s' %s can't fit into %s '%s'", + sm_warning("'%s' %s can't fit into %s '%s'", right_name, sval_to_numstr(sval), sval_to_numstr(max), left_name); free_string(left_name); } @@ -75,10 +75,10 @@ static void match_assign(struct expression *expr) return; left_name = expr_to_str(expr->left); if (min.value == 0) { - sm_msg("warn: assigning %s to unsigned variable '%s'", + sm_warning("assigning %s to unsigned variable '%s'", sval_to_str(sval), left_name); } else { - sm_msg("warn: value %s can't fit into %s '%s'", + sm_warning("value %s can't fit into %s '%s'", sval_to_str(sval), sval_to_str(min), left_name); } free_string(left_name); @@ -222,7 +222,7 @@ static int print_unsigned_never_less_than_zero(struct expression *expr) return 0; name = expr_to_str(expr->left); - sm_msg("warn: unsigned '%s' is never less than zero.", name); + sm_warning("unsigned '%s' is never less than zero.", name); free_string(name); return 1; } @@ -286,7 +286,7 @@ static void match_condition(struct expression *expr) if (!possibly_true_rl(rl_left, expr->op, rl_right)) { char *name = expr_to_str(expr); - sm_msg("warn: impossible condition '(%s) => (%s %s %s)'", name, + sm_warning("impossible condition '(%s) => (%s %s %s)'", name, show_rl(rl_left), show_special(expr->op), show_rl(rl_right)); free_string(name); @@ -295,7 +295,7 @@ static void match_condition(struct expression *expr) if (!possibly_false_rl(rl_left, expr->op, rl_right)) { char *name = expr_to_str(expr); - sm_msg("warn: always true condition '(%s) => (%s %s %s)'", name, + sm_warning("always true condition '(%s) => (%s %s %s)'", name, show_rl(rl_left_orig), show_special(expr->op), show_rl(rl_right_orig)); free_string(name); diff --git a/check_signed_integer_overflow_check.c b/check_signed_integer_overflow_check.c index e433487e..aabd7ab9 100644 --- a/check_signed_integer_overflow_check.c +++ b/check_signed_integer_overflow_check.c @@ -58,7 +58,7 @@ static void match_condition(struct expression *expr) if (has_variable(left, right) == 1) { left_name = expr_to_str(left); right_name = expr_to_str(right); - sm_msg("warn: signed overflow undefined. '%s %s %s'", left_name, show_special(expr->op), right_name); + sm_warning("signed overflow undefined. '%s %s %s'", left_name, show_special(expr->op), right_name); free_string(left_name); free_string(right_name); } @@ -92,7 +92,7 @@ static void match_binop(struct expression *expr) return; str = expr_to_str(expr); - sm_msg("warn: potential negative subtraction from max '%s'", str); + sm_warning("potential negative subtraction from max '%s'", str); free_string(str); } diff --git a/check_sizeof.c b/check_sizeof.c index 47885b1c..6f4f3a6e 100644 --- a/check_sizeof.c +++ b/check_sizeof.c @@ -35,7 +35,7 @@ static void check_pointer(struct expression *expr, char *ptr_name) return; if (strcmp(ptr_name, name) == 0) - sm_msg("warn: was 'sizeof(*%s)' intended?", ptr_name); + sm_warning("was 'sizeof(*%s)' intended?", ptr_name); free_string(name); } @@ -69,7 +69,7 @@ static void check_passes_pointer(char *name, struct expression *call) if (!ptr_name) continue; if (strcmp(name, ptr_name) == 0) - sm_msg("warn: was 'sizeof(*%s)' intended?", name); + sm_warning("was 'sizeof(*%s)' intended?", name); free_string(ptr_name); } END_FOR_EACH_PTR(arg); } @@ -107,19 +107,19 @@ static void check_sizeof_number(struct expression *expr) return; } END_FOR_EACH_PTR(tmp); - sm_msg("warn: sizeof(NUMBER)?"); + sm_warning("sizeof(NUMBER)?"); } static void match_sizeof(struct expression *expr) { check_sizeof_number(expr); if (expr->type == EXPR_PREOP && expr->op == '&') - sm_msg("warn: sizeof(&pointer)?"); + sm_warning("sizeof(&pointer)?"); if (expr->type == EXPR_SIZEOF) - sm_msg("warn: sizeof(sizeof())?"); + sm_warning("sizeof(sizeof())?"); /* the ilog2() macro is a valid place to check the size of a binop */ if (expr->type == EXPR_BINOP && !get_macro_name(expr->pos)) - sm_msg("warn: taking sizeof binop"); + sm_warning("taking sizeof binop"); } static void register_macro_takes_sizeof_argument(void) diff --git a/check_snprintf.c b/check_snprintf.c index aea9f637..162e07c6 100644 --- a/check_snprintf.c +++ b/check_snprintf.c @@ -66,7 +66,7 @@ static void match_call(struct expression *expr) if (!old_buflen) return; if (get_absolute_max(arg, &max) && sval_cmp_val(max, old_buflen) > 0) - sm_msg("warn: '%s' returned from snprintf() might be larger than %d", + sm_warning("'%s' returned from snprintf() might be larger than %d", sm->name, old_buflen); } END_FOR_EACH_PTR(arg); } diff --git a/check_spectre.c b/check_spectre.c index 112a8065..bb43c88a 100644 --- a/check_spectre.c +++ b/check_spectre.c @@ -188,7 +188,7 @@ static void array_check(struct expression *expr) conditions = get_conditions(offset); name = expr_to_str(array_expr); - sm_msg("warn: potential spectre issue '%s' [%s]%s", + sm_warning("potential spectre issue '%s' [%s]%s", name, is_read(expr) ? "r" : "w", conditions ? " (local cap)" : ""); diff --git a/check_stack.c b/check_stack.c index aede8b89..b91586fa 100644 --- a/check_stack.c +++ b/check_stack.c @@ -54,7 +54,7 @@ static void match_declarations(struct symbol *sym) } if (type_bytes(base) >= MAX_ALLOWED) { complained = 1; - sm_msg("warn: '%s' puts %d bytes on stack", name, type_bytes(base)); + sm_warning("'%s' puts %d bytes on stack", name, type_bytes(base)); } add_scope_hook(&scope_end, INT_PTR(type_bytes(base))); } diff --git a/check_strcpy_overflow.c b/check_strcpy_overflow.c index 218f08b3..cc7784b1 100644 --- a/check_strcpy_overflow.c +++ b/check_strcpy_overflow.c @@ -49,7 +49,7 @@ static void match_strcpy(const char *fn, struct expression *expr, void *unused) sm_msg("error: %s() '%s' too large for '%s' (%d vs %d)", fn, data_name, dest_name, data_size, dest_size); else if (option_spammy) - sm_msg("warn: %s() '%s' of unknown size might be too large for '%s'", + sm_warning("%s() '%s' of unknown size might be too large for '%s'", fn, data_name, dest_name); free_string(dest_name); diff --git a/check_struct_type.c b/check_struct_type.c index 0a46010b..bbe74da2 100644 --- a/check_struct_type.c +++ b/check_struct_type.c @@ -48,7 +48,7 @@ static void match_assign(const char *fn, struct expression *expr, void *_size_ar return; if (strcmp(left_type->ident->name, size_type->ident->name) == 0) return; - sm_msg("warn: struct type mismatch '%s vs %s'", left_type->ident->name, + sm_warning("struct type mismatch '%s vs %s'", left_type->ident->name, size_type->ident->name); } diff --git a/check_template.c b/check_template.c index 626d4140..6e8b6aa5 100644 --- a/check_template.c +++ b/check_template.c @@ -94,7 +94,7 @@ static void match_return(struct expression *ret_value) stree = __get_cur_stree(); FOR_EACH_MY_SM(my_id, stree, tmp) { if (tmp->state != &unlock) - sm_msg("warn: returned negative with %s semaphore held", + sm_warning("returned negative with %s semaphore held", tmp->name); } END_FOR_EACH_SM(tmp); } diff --git a/check_test_bit.c b/check_test_bit.c index 2ee1143f..579228c8 100644 --- a/check_test_bit.c +++ b/check_test_bit.c @@ -35,7 +35,7 @@ static void match_test_bit(const char *fn, struct expression *expr, void *data) macro = get_macro_name(arg->pos); if (macro && strstr(macro, "cpu_has")) return; - sm_msg("warn: test_bit() takes a bit number"); + sm_warning("test_bit() takes a bit number"); } void check_test_bit(int id) diff --git a/check_uninitialized.c b/check_uninitialized.c index 7d553206..9cf28f36 100644 --- a/check_uninitialized.c +++ b/check_uninitialized.c @@ -167,7 +167,7 @@ static void match_call(struct expression *expr) continue; name = expr_to_str(arg); - sm_warning("warn: passing uninitialized '%s'", name); + sm_warning("passing uninitialized '%s'", name); free_string(name); set_state_expr(my_id, arg, &initialized); diff --git a/check_unwind.c b/check_unwind.c index 31c8235b..9fa6d0cf 100644 --- a/check_unwind.c +++ b/check_unwind.c @@ -149,7 +149,7 @@ static void match_return(struct expression *ret_value) stree = __get_cur_stree(); FOR_EACH_MY_SM(my_id, stree, tmp) { if (slist_has_state(tmp->possible, &allocated)) - sm_msg("warn: '%s' was not released on error", tmp->name); + sm_warning("'%s' was not released on error", tmp->name); } END_FOR_EACH_SM(tmp); } diff --git a/check_wine_WtoA.c b/check_wine_WtoA.c index 9648cd31..f074471b 100644 --- a/check_wine_WtoA.c +++ b/check_wine_WtoA.c @@ -73,7 +73,7 @@ static void match_call(struct expression *expr) goto free; len = strlen(fn_name); if (fn_name[len - 1] == 'A' && !allowed_func(fn_name)) { - sm_msg("warn: WtoA call '%s()'", fn_name); + sm_warning("WtoA call '%s()'", fn_name); } free: free_string(fn_name); diff --git a/check_wrong_size_arg.c b/check_wrong_size_arg.c index 2a8b8d5f..06753d23 100644 --- a/check_wrong_size_arg.c +++ b/check_wrong_size_arg.c @@ -33,7 +33,7 @@ static void match_parameter(const char *fn, struct expression *expr, void *_para return; name = expr_to_str_sym(arg, NULL); - sm_msg("warn: expected a buffer size but got a comparison '%s'", name); + sm_warning("expected a buffer size but got a comparison '%s'", name); free_string(name); } diff --git a/check_zero_to_err_ptr.c b/check_zero_to_err_ptr.c index 29196b7b..8d5984a1 100644 --- a/check_zero_to_err_ptr.c +++ b/check_zero_to_err_ptr.c @@ -111,14 +111,14 @@ static void match_err_ptr(const char *fn, struct expression *expr, void *data) continue; if (is_valid_ptr(estate_min(tmp->state)) && is_valid_ptr(estate_max(tmp->state))) { - sm_msg("warn: passing a valid pointer to '%s'", fn); + sm_warning("passing a valid pointer to '%s'", fn); return; } if (!rl_to_sval(estate_rl(tmp->state), &sval)) continue; if (sval.value != 0) continue; - sm_msg("warn: passing zero to '%s'", fn); + sm_warning("passing zero to '%s'", fn); return; } END_FOR_EACH_PTR(tmp); } diff --git a/smatch_buf_comparison.c b/smatch_buf_comparison.c index 7ef6bd81..d142817a 100644 --- a/smatch_buf_comparison.c +++ b/smatch_buf_comparison.c @@ -239,7 +239,7 @@ static void array_check(struct expression *expr) array_str = expr_to_str(array); offset_str = expr_to_str(offset); - sm_msg("warn: potentially one past the end of array '%s[%s]'", array_str, offset_str); + sm_warning("potentially one past the end of array '%s[%s]'", array_str, offset_str); free_string(array_str); free_string(offset_str); } @@ -402,7 +402,7 @@ static void array_check_data_info(struct expression *expr) if (equal_name) { char *array_name = expr_to_str(array); - sm_msg("warn: potential off by one '%s[]' limit '%s'", array_name, equal_name); + sm_warning("potential off by one '%s[]' limit '%s'", array_name, equal_name); free_string(array_name); } diff --git a/smatch_flow.c b/smatch_flow.c index 31503d56..ca36eaa0 100644 --- a/smatch_flow.c +++ b/smatch_flow.c @@ -1123,7 +1123,7 @@ void __split_stmt(struct statement *stmt) if (empty_statement(stmt->if_true) && last_stmt_on_same_line() && !get_macro_name(stmt->if_true->pos)) - sm_msg("warn: if();"); + sm_warning("if();"); __push_true_states(); __use_false_states(); __split_stmt(stmt->if_false); -- 2.14.1