[PATCH 08/12] Convert sm_msg() with an error: prefix into sm_error()

John Levon <[email protected]>
Newsgroups org.kernel.vger.smatch
Message-ID <[email protected]>
Signed-off-by: John Levon <[email protected]>
---
 check_allocating_enough_data.c  |  2 +-
 check_atomic_inc_dec.c          |  4 +--
 check_bogus_irqrestore.c        |  2 +-
 check_check_deref.c             |  4 +--
 check_debug.c                   | 12 ++++-----
 check_deref.c                   | 12 ++++-----
 check_dev_queue_xmit.c          |  2 +-
 check_dma_on_stack.c            |  4 +--
 check_err_ptr_deref.c           | 10 ++++----
 check_free.c                    |  6 ++---
 check_free_strict.c             |  6 ++---
 check_gfp_dma.c                 |  2 +-
 check_index_overflow.c          |  6 ++---
 check_input_free_device.c       |  2 +-
 check_kernel_printf.c           | 56 ++++++++++++++++++++---------------------
 check_locking.c                 |  6 ++---
 check_memcpy_overflow.c         |  2 +-
 check_memory.c                  |  4 +--
 check_memset.c                  |  2 +-
 check_snprintf_overflow.c       |  4 +--
 check_sprintf_overflow.c        |  2 +-
 check_strcpy_overflow.c         |  2 +-
 check_string_len.c              |  2 +-
 check_testing_index_after_use.c |  2 +-
 check_type.c                    |  4 +--
 check_wait_for_common.c         |  2 +-
 check_wine_filehandles.c        |  2 +-
 27 files changed, 82 insertions(+), 82 deletions(-)

diff --git a/check_allocating_enough_data.c b/check_allocating_enough_data.c
index 5b55ed5..12cb72b 100644
--- a/check_allocating_enough_data.c
+++ b/check_allocating_enough_data.c
@@ -42,7 +42,7 @@ static void db_returns_buf_size(struct expression *expr, int param, char *unused
 		return;
 	if (sval.uvalue >= bytes)
 		return;
-	sm_msg("error: not allocating enough data %d vs %s", bytes, sval_to_str(sval));
+	sm_error("not allocating enough data %d vs %s", bytes, sval_to_str(sval));
 }
 
 void check_allocating_enough_data(int id)
diff --git a/check_atomic_inc_dec.c b/check_atomic_inc_dec.c
index a7c5ae7..6474323 100644
--- a/check_atomic_inc_dec.c
+++ b/check_atomic_inc_dec.c
@@ -49,11 +49,11 @@ static void db_inc_dec(struct expression *expr, int param, const char *key, cons
 
 	if (inc_dec == ATOMIC_INC) {
 //		if (start_state == &inc)
-//			sm_msg("error: XXX double increment '%s'", name);
+//			sm_error("XXX double increment '%s'", name);
 		set_state(my_id, name, sym, &inc);
 	} else {
 //		if (start_state == &dec)
-//			sm_msg("error: XXX double decrement '%s'", name);
+//			sm_error("XXX double decrement '%s'", name);
 		if (start_state == &inc)
 			set_state(my_id, name, sym, &orig);
 		else
diff --git a/check_bogus_irqrestore.c b/check_bogus_irqrestore.c
index 7b19037..c47077a 100644
--- a/check_bogus_irqrestore.c
+++ b/check_bogus_irqrestore.c
@@ -27,7 +27,7 @@ static void match_irqrestore(const char *fn, struct expression *expr, void *data
 	arg_expr = get_argument_from_call_expr(expr->args, 1);
 	if (!get_implied_value(arg_expr, &tmp))
 		return;
-	sm_msg("error: calling '%s()' with bogus flags", fn);
+	sm_error("calling '%s()' with bogus flags", fn);
 }
 
 void check_bogus_irqrestore(int id)
diff --git a/check_check_deref.c b/check_check_deref.c
index 725eca9..da2a5c9 100644
--- a/check_check_deref.c
+++ b/check_check_deref.c
@@ -69,7 +69,7 @@ static void check_dereference(struct expression *expr)
 		if (tmp->state == &ok)
 			continue;
 		if (tmp->state == &null) {
-			sm_msg("error: we previously assumed '%s' could be null (see line %d)",
+			sm_error("we previously assumed '%s' could be null (see line %d)",
 			       tmp->name, tmp->line);
 			add_ignore(my_id, sm->name, sm->sym);
 			return;
@@ -96,7 +96,7 @@ static void check_dereference_name_sym(char *name, struct symbol *sym)
 		if (tmp->state == &ok)
 			continue;
 		if (tmp->state == &null) {
-			sm_msg("error: we previously assumed '%s' could be null (see line %d)",
+			sm_error("we previously assumed '%s' could be null (see line %d)",
 			       tmp->name, tmp->line);
 			add_ignore(my_id, sm->name, sm->sym);
 			return;
diff --git a/check_debug.c b/check_debug.c
index 079faf6..d55865e 100644
--- a/check_debug.c
+++ b/check_debug.c
@@ -45,12 +45,12 @@ static void match_state(const char *fn, struct expression *expr, void *info)
 
 	check_arg = get_argument_from_call_expr(expr->args, 0);
 	if (check_arg->type != EXPR_STRING) {
-		sm_msg("error:  the check_name argument to %s is supposed to be a string literal", fn);
+		sm_error("the check_name argument to %s is supposed to be a string literal", fn);
 		return;
 	}
 	state_arg = get_argument_from_call_expr(expr->args, 1);
 	if (!state_arg || state_arg->type != EXPR_STRING) {
-		sm_msg("error:  the state_name argument to %s is supposed to be a string literal", fn);
+		sm_error("the state_name argument to %s is supposed to be a string literal", fn);
 		return;
 	}
 
@@ -75,7 +75,7 @@ static void match_states(const char *fn, struct expression *expr, void *info)
 
 	check_arg = get_argument_from_call_expr(expr->args, 0);
 	if (check_arg->type != EXPR_STRING) {
-		sm_msg("error:  the check_name argument to %s is supposed to be a string literal", fn);
+		sm_error("the check_name argument to %s is supposed to be a string literal", fn);
 		return;
 	}
 
@@ -103,7 +103,7 @@ static void match_print_value(const char *fn, struct expression *expr, void *inf
 
 	arg_expr = get_argument_from_call_expr(expr->args, 0);
 	if (arg_expr->type != EXPR_STRING) {
-		sm_msg("error:  the argument to %s is supposed to be a string literal", fn);
+		sm_error("the argument to %s is supposed to be a string literal", fn);
 		return;
 	}
 
@@ -352,7 +352,7 @@ static void match_possible(const char *fn, struct expression *expr, void *info)
 
 	arg_expr = get_argument_from_call_expr(expr->args, 0);
 	if (arg_expr->type != EXPR_STRING) {
-		sm_msg("error:  the argument to %s is supposed to be a string literal", fn);
+		sm_error("the argument to %s is supposed to be a string literal", fn);
 		return;
 	}
 
@@ -415,7 +415,7 @@ static void match_note(const char *fn, struct expression *expr, void *info)
 
 	arg_expr = get_argument_from_call_expr(expr->args, 0);
 	if (arg_expr->type != EXPR_STRING) {
-		sm_msg("error:  the argument to %s is supposed to be a string literal", fn);
+		sm_error("the argument to %s is supposed to be a string literal", fn);
 		return;
 	}
 	sm_msg("%s", arg_expr->string->data);
diff --git a/check_deref.c b/check_deref.c
index 59561d9..d8777db 100644
--- a/check_deref.c
+++ b/check_deref.c
@@ -87,15 +87,15 @@ static void check_dereference(struct expression *expr)
 		add_ignore(my_id, sm->name, sm->sym);
 		if (tmp->state == &null) {
 			if (option_spammy)
-				sm_msg("error: potential NULL dereference '%s'.", tmp->name);
+				sm_error("potential NULL dereference '%s'.", tmp->name);
 			return;
 		}
 		if (tmp->state == &uninitialized) {
 			if (option_spammy)
-				sm_msg("error: potentially dereferencing uninitialized '%s'.", tmp->name);
+				sm_error("potentially dereferencing uninitialized '%s'.", tmp->name);
 			return;
 		}
-		sm_msg("error: potential null dereference '%s'.  (%s returns null)",
+		sm_error("potential null dereference '%s'.  (%s returns null)",
 			tmp->name, tmp->state->name);
 		return;
 	} END_FOR_EACH_PTR(tmp);
@@ -124,15 +124,15 @@ static void check_dereference_name_sym(char *name, struct symbol *sym)
 		add_ignore(my_id, sm->name, sm->sym);
 		if (tmp->state == &null) {
 			if (option_spammy)
-				sm_msg("error: potential NULL dereference '%s'.", tmp->name);
+				sm_error("potential NULL dereference '%s'.", tmp->name);
 			return;
 		}
 		if (tmp->state == &uninitialized) {
 			if (option_spammy)
-				sm_msg("error: potentially dereferencing uninitialized '%s'.", tmp->name);
+				sm_error("potentially dereferencing uninitialized '%s'.", tmp->name);
 			return;
 		}
-		sm_msg("error: potential null dereference '%s'.  (%s returns null)",
+		sm_error("potential null dereference '%s'.  (%s returns null)",
 			tmp->name, tmp->state->name);
 		return;
 	} END_FOR_EACH_PTR(tmp);
diff --git a/check_dev_queue_xmit.c b/check_dev_queue_xmit.c
index 5a9c13d..c794e65 100644
--- a/check_dev_queue_xmit.c
+++ b/check_dev_queue_xmit.c
@@ -68,7 +68,7 @@ static void match_symbol(struct expression *expr)
 	if (valid_use())
 		return;
 	name = expr_to_var(expr);
-	sm_msg("error: '%s' was already used up by dev_queue_xmit()", name);
+	sm_error("'%s' was already used up by dev_queue_xmit()", name);
 	free_string(name);
 }
 
diff --git a/check_dma_on_stack.c b/check_dma_on_stack.c
index b6ac482..ffa9ae9 100644
--- a/check_dma_on_stack.c
+++ b/check_dma_on_stack.c
@@ -33,7 +33,7 @@ static void match_dma_func(const char *fn, struct expression *expr, void *param)
 		if (arg->unop->type != EXPR_SYMBOL)
 			return;
 		name = expr_to_str(arg);
-		sm_msg("error: doing dma on the stack (%s)", name);
+		sm_error("doing dma on the stack (%s)", name);
 		free_string(name);
 		return;
 	}
@@ -45,7 +45,7 @@ static void match_dma_func(const char *fn, struct expression *expr, void *param)
 	if (get_param_num(arg) >= 0)
 		return;
 	name = expr_to_var(arg);
-	sm_msg("error: doing dma on the stack (%s)", name);
+	sm_error("doing dma on the stack (%s)", name);
 	free_string(name);
 }
 
diff --git a/check_err_ptr_deref.c b/check_err_ptr_deref.c
index e01fb75..50a79cd 100644
--- a/check_err_ptr_deref.c
+++ b/check_err_ptr_deref.c
@@ -58,7 +58,7 @@ static void check_is_err_ptr(struct expression *expr)
 	if (!possibly_true_rl(rl, SPECIAL_EQUAL, err_ptr_rl))
 		return;
 
-	sm_msg("error: '%s' dereferencing possible ERR_PTR()", sm->name);
+	sm_error("'%s' dereferencing possible ERR_PTR()", sm->name);
 	set_state(my_id, sm->name, sm->sym, &checked);
 }
 
@@ -90,7 +90,7 @@ static void set_param_dereferenced(struct expression *call, struct expression *a
 	if (!estate || !possibly_true_rl(estate_rl(estate), SPECIAL_EQUAL, err_ptr_rl))
 		goto free;
 
-	sm_msg("error: '%s' dereferencing possible ERR_PTR()", sm->name);
+	sm_error("'%s' dereferencing possible ERR_PTR()", sm->name);
 	set_state(my_id, sm->name, sm->sym, &checked);
 
 free:
@@ -180,7 +180,7 @@ static void match_err_ptr_positive_const(const char *fn, struct expression *expr
 	if (!get_value(arg, &sval))
 		return;
 	if (sval_is_positive(sval) && sval_cmp_val(sval, 0) != 0)
-		sm_msg("error: passing non negative %s to ERR_PTR", sval_to_str(sval));
+		sm_error("passing non negative %s to ERR_PTR", sval_to_str(sval));
 }
 
 static void match_err_ptr(const char *fn, struct expression *expr, void *unused)
@@ -206,9 +206,9 @@ static void match_err_ptr(const char *fn, struct expression *expr, void *unused)
 			max = tmp_max;
 	} END_FOR_EACH_PTR(tmp);
 	if (sval_is_negative(min) && sval_cmp_val(min, -4095) < 0)
-		sm_msg("error: %s too low for ERR_PTR", sval_to_str(min));
+		sm_error("%s too low for ERR_PTR", sval_to_str(min));
 	if (sval_is_positive(max) && sval_cmp_val(max, 0) != 0)
-		sm_msg("error: passing non negative %s to ERR_PTR", sval_to_str(max));
+		sm_error("passing non negative %s to ERR_PTR", sval_to_str(max));
 }
 
 void check_err_ptr_deref(int id)
diff --git a/check_free.c b/check_free.c
index 9e9d835..44df17e 100644
--- a/check_free.c
+++ b/check_free.c
@@ -92,7 +92,7 @@ static void match_dereferences(struct expression *expr)
 	if (!is_freed(expr))
 		return;
 	name = expr_to_var(expr);
-	sm_msg("error: dereferencing freed memory '%s'", name);
+	sm_error("dereferencing freed memory '%s'", name);
 	set_state_expr(my_id, expr, &ok);
 	free_string(name);
 }
@@ -176,7 +176,7 @@ static void match_call(struct expression *expr)
 
 		name = expr_to_var(arg);
 		if (is_free_func(expr->fn))
-			sm_msg("error: double free of '%s'", name);
+			sm_error("double free of '%s'", name);
 		else
 			sm_warning("passing freed memory '%s'", name);
 		set_state_expr(my_id, arg, &ok);
@@ -217,7 +217,7 @@ static void match_free(const char *fn, struct expression *expr, void *param)
 	if (is_freed(arg)) {
 		char *name = expr_to_var(arg);
 
-		sm_msg("error: double free of '%s'", name);
+		sm_error("double free of '%s'", name);
 		free_string(name);
 	}
 	set_state_expr(my_id, arg, &freed);
diff --git a/check_free_strict.c b/check_free_strict.c
index bf75021..ae23938 100644
--- a/check_free_strict.c
+++ b/check_free_strict.c
@@ -89,7 +89,7 @@ static void match_dereferences(struct expression *expr)
 	if (!is_freed(expr))
 		return;
 	name = expr_to_var(expr);
-	sm_msg("error: dereferencing freed memory '%s'", name);
+	sm_error("dereferencing freed memory '%s'", name);
 	set_state_expr(my_id, expr, &ok);
 	free_string(name);
 }
@@ -173,7 +173,7 @@ static void match_call(struct expression *expr)
 
 		name = expr_to_var(arg);
 		if (is_free_func(expr->fn))
-			sm_msg("error: double free of '%s'", name);
+			sm_error("double free of '%s'", name);
 		else
 			sm_warning("passing freed memory '%s'", name);
 		set_state_expr(my_id, arg, &ok);
@@ -212,7 +212,7 @@ static void match_free(const char *fn, struct expression *expr, void *param)
 	if (is_freed(arg)) {
 		char *name = expr_to_var(arg);
 
-		sm_msg("error: double free of '%s'", name);
+		sm_error("double free of '%s'", name);
 		free_string(name);
 	}
 	set_state_expr(my_id, arg, &freed);
diff --git a/check_gfp_dma.c b/check_gfp_dma.c
index 755ed85..aeeb7b3 100644
--- a/check_gfp_dma.c
+++ b/check_gfp_dma.c
@@ -38,7 +38,7 @@ static void match_alloc(const char *fn, struct expression *expr, void *_arg)
 	if (sval.uvalue == 0) /* GFP_NOWAIT */
 		return;
 	if (!(sval.uvalue & ~GFP_ZONEMASK))
-		sm_msg("error: no modifiers for allocation.");
+		sm_error("no modifiers for allocation.");
 }
 
 void check_gfp_dma(int id)
diff --git a/check_index_overflow.c b/check_index_overflow.c
index 4e2be88..39815e6 100644
--- a/check_index_overflow.c
+++ b/check_index_overflow.c
@@ -315,14 +315,14 @@ static void array_check(struct expression *expr)
 		return;
 
 	if (no_break) {
-		sm_msg("error: buffer overflow '%s' %d <= %s (assuming for loop doesn't break)",
+		sm_error("buffer overflow '%s' %d <= %s (assuming for loop doesn't break)",
 			name, array_size, sval_to_str(max));
 	} else if (user_rl) {
-		sm_msg("error: buffer overflow '%s' %d <= %s user_rl='%s'%s",
+		sm_error("buffer overflow '%s' %d <= %s user_rl='%s'%s",
 			name, array_size, sval_to_str(max), show_rl(user_rl),
 			is_subtract(offset) ? " subtract" : "");
 	} else {
-		sm_msg("error: buffer overflow '%s' %d <= %s%s",
+		sm_error("buffer overflow '%s' %d <= %s%s",
 			name, array_size, sval_to_str(max),
 			is_subtract(offset) ? " subtract" : "");
 	}
diff --git a/check_input_free_device.c b/check_input_free_device.c
index e863958..b450670 100644
--- a/check_input_free_device.c
+++ b/check_input_free_device.c
@@ -55,7 +55,7 @@ static void match_input_free(const char *fn, struct expression *expr, void *data
 		return;
 	if (!slist_has_state(sm->possible, &no_free))
 		return;
-	sm_msg("error: don't call input_free_device() after input_unregister_device()");
+	sm_error("don't call input_free_device() after input_unregister_device()");
 }
 
 void check_input_free_device(int id)
diff --git a/check_kernel_printf.c b/check_kernel_printf.c
index 997f89a..38ae02b 100644
--- a/check_kernel_printf.c
+++ b/check_kernel_printf.c
@@ -379,7 +379,7 @@ static void ip4(const char *fmt, struct symbol *type, struct symbol *basetype, i
 
 
 	if (type->ctype.modifiers & MOD_NODEREF)
-		sm_msg("error: passing __user pointer to '%%p%c4'", fmt[0]);
+		sm_error("passing __user pointer to '%%p%c4'", fmt[0]);
 
 	/*
 	 * If we have a pointer to char/u8/s8, we expect the caller to
@@ -415,7 +415,7 @@ static void ip6(const char *fmt, struct symbol *type, struct symbol *basetype, i
 	}
 
 	if (type->ctype.modifiers & MOD_NODEREF)
-		sm_msg("error: passing __user pointer to '%%p%c6'", fmt[0]);
+		sm_error("passing __user pointer to '%%p%c6'", fmt[0]);
 }
 
 static void ipS(const char *fmt, struct symbol *type, struct symbol *basetype, int vaidx)
@@ -443,7 +443,7 @@ static void ipS(const char *fmt, struct symbol *type, struct symbol *basetype, i
 	    !has_struct_tag(basetype, "sockaddr_in") &&
 	    !has_struct_tag(basetype, "sockaddr_in6") &&
 	    !has_struct_tag(basetype, "__kernel_sockaddr_storage"))
-		sm_msg("error: '%%p%cS' expects argument of type struct sockaddr *, "
+		sm_error("'%%p%cS' expects argument of type struct sockaddr *, "
 			"argument %d has type '%s'", fmt[0], vaidx, type_to_str(type));
 }
 
@@ -457,7 +457,7 @@ static void hex_string(const char *fmt, struct symbol *type, struct symbol *base
 			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");
+		sm_error("passing __user pointer to %%ph");
 }
 
 static void escaped_string(const char *fmt, struct symbol *type, struct symbol *basetype, int vaidx)
@@ -468,14 +468,14 @@ static void escaped_string(const char *fmt, struct symbol *type, struct symbol *
 			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");
+		sm_error("passing __user pointer to %%pE");
 }
 
 static void resource_string(const char *fmt, struct symbol *type, struct symbol *basetype, int vaidx)
 {
 	assert(tolower(fmt[0]) == 'r');
 	if (!is_struct_tag(basetype, "resource")) {
-		sm_msg("error: '%%p%c' expects argument of type struct resource *, "
+		sm_error("'%%p%c' expects argument of type struct resource *, "
 			"but argument %d has type '%s'", fmt[0], vaidx, type_to_str(type));
 	}
 	if (isalnum(fmt[1]))
@@ -499,7 +499,7 @@ static void mac_address_string(const char *fmt, struct symbol *type, struct symb
 			fmt[0], vaidx, type_to_str(type));
 	}
 	if (type->ctype.modifiers & MOD_NODEREF)
-		sm_msg("error: passing __user pointer to '%%p%c'", fmt[0]);
+		sm_error("passing __user pointer to '%%p%c'", fmt[0]);
 }
 
 static void dentry_file(const char *fmt, struct symbol *type, struct symbol *basetype, int vaidx)
@@ -517,7 +517,7 @@ static void dentry_file(const char *fmt, struct symbol *type, struct symbol *bas
 	}
 
 	if (!is_struct_tag(basetype, tag))
-		sm_msg("error: '%%p%c' expects argument of type struct '%s*', argument %d has type '%s'",
+		sm_error("'%%p%c' expects argument of type struct '%s*', argument %d has type '%s'",
 			fmt[0], tag, vaidx, type_to_str(type));
 }
 
@@ -531,7 +531,7 @@ static void check_clock(const char *fmt, struct symbol *type, struct symbol *bas
 			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'",
+		sm_error("'%%pC' expects argument of type 'struct clk*', argument %d has type '%s'",
 		       vaidx, type_to_str(type));
 }
 
@@ -541,7 +541,7 @@ static void va_format(const char *fmt, struct symbol *type, struct symbol *baset
 	if (isalnum(fmt[1]))
 		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));
+		sm_error("%%pV expects argument of type struct va_format*, argument %d has type '%s'", vaidx, type_to_str(type));
 }
 
 static void netdev_feature(const char *fmt, struct symbol *type, struct symbol *basetype, int vaidx)
@@ -550,7 +550,7 @@ static void netdev_feature(const char *fmt, struct symbol *type, struct symbol *
 
 	assert(fmt[0] == 'N');
 	if (fmt[1] != 'F') {
-		sm_msg("error: %%pN must be followed by 'F'");
+		sm_error("%%pN must be followed by 'F'");
 		return;
 	}
 	if (isalnum(fmt[2]))
@@ -560,7 +560,7 @@ static void netdev_feature(const char *fmt, struct symbol *type, struct symbol *
 	if (!netdev.sym)
 		return;
 	if (basetype != netdev.sym)
-		sm_msg("error: %%pNF expects argument of type netdev_features_t*, argument %d has type '%s'",
+		sm_error("%%pNF expects argument of type netdev_features_t*, argument %d has type '%s'",
 			vaidx, type_to_str(type));
 
 }
@@ -582,17 +582,17 @@ static void address_val(const char *fmt, struct symbol *type, struct symbol *bas
 			suf = "p";
 			break;
 		default:
-			sm_msg("error: '%%pa' can only be followed by one of [dp]");
+			sm_error("'%%pa' can only be followed by one of [dp]");
 		}
 		if (isalnum(fmt[2]))
-			sm_msg("error: '%%pa%c' cannot be followed by '%c'", fmt[1], fmt[2]);
+			sm_error("'%%pa%c' cannot be followed by '%c'", fmt[1], fmt[2]);
 	}
 
 	typedef_lookup(which);
 	if (!which->sym)
 		return;
 	if (basetype != which->sym) {
-		sm_msg("error: '%%pa%s' expects argument of type '%s*', argument %d has type '%s'",
+		sm_error("'%%pa%s' expects argument of type '%s*', argument %d has type '%s'",
 			suf, which->name, vaidx, type_to_str(type));
 	}
 }
@@ -606,7 +606,7 @@ static void block_device(const char *fmt, struct symbol *type, struct symbol *ba
 		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'",
+		sm_error("'%%p%c' expects argument of type struct '%s*', argument %d has type '%s'",
 			fmt[0], tag, vaidx, type_to_str(type));
 }
 
@@ -616,35 +616,35 @@ static void flag_string(const char *fmt, struct symbol *type, struct symbol *bas
 
 	assert(fmt[0] == 'G');
 	if (!isalnum(fmt[1])) {
-		sm_msg("error: %%pG must be followed by one of [gpv]");
+		sm_error("%%pG must be followed by one of [gpv]");
 		return;
 	}
 	switch (fmt[1]) {
 	case 'p':
 	case 'v':
 		if (basetype != &ulong_ctype)
-			sm_msg("error: '%%pG%c' expects argument of type 'unsigned long *', argument %d has type '%s'",
+			sm_error("'%%pG%c' expects argument of type 'unsigned long *', argument %d has type '%s'",
 				fmt[1], vaidx, type_to_str(type));
 		break;
 	case 'g':
 		typedef_lookup(&gfp);
 		if (basetype != gfp.sym)
-			sm_msg("error: '%%pGg' expects argument of type 'gfp_t *', argument %d has type '%s'",
+			sm_error("'%%pGg' expects argument of type 'gfp_t *', argument %d has type '%s'",
 				vaidx, type_to_str(type));
 		break;
 	default:
-		sm_msg("error: '%%pG' must be followed by one of [gpv]");
+		sm_error("'%%pG' must be followed by one of [gpv]");
 	}
 }
 
 static void device_node_string(const char *fmt, struct symbol *type, struct symbol *basetype, int vaidx)
 {
 	if (fmt[1] != 'F') {
-		sm_msg("error: %%pO can only be followed by 'F'");
+		sm_error("%%pO can only be followed by 'F'");
 		return;
 	}
 	if (!is_struct_tag(basetype, "device_node"))
-		sm_msg("error: '%%pOF' expects argument of type 'struct device_node*', argument %d has type '%s'",
+		sm_error("'%%pOF' expects argument of type 'struct device_node*', argument %d has type '%s'",
 		       vaidx, type_to_str(type));
 }
 
@@ -659,7 +659,7 @@ pointer(const char *fmt, struct expression *arg, int vaidx)
 		return;
 	}
 	if (!is_ptr_type(type)) {
-		sm_msg("error: %%p expects pointer argument, but argument %d has type '%s'",
+		sm_error("%%p expects pointer argument, but argument %d has type '%s'",
 			vaidx, type_to_str(type));
 		return;
 	}
@@ -772,7 +772,7 @@ pointer(const char *fmt, struct expression *arg, int vaidx)
 		/* 'x' is for an unhashed pointer */
 		break;
 	default:
-		sm_msg("error: unrecognized %%p extension '%c', treated as normal %%p", *fmt);
+		sm_error("unrecognized %%p extension '%c', treated as normal %%p", *fmt);
 	}
 }
 
@@ -1062,15 +1062,15 @@ do_check_printf_call(const char *caller, const char *name, struct expression *ca
 		/* 	break; */
 
 		case FORMAT_TYPE_INVALID:
-			sm_msg("error: format specifier '%.*s' invalid", read, old_fmt);
+			sm_error("format specifier '%.*s' invalid", read, old_fmt);
 			return;
 
 		case FORMAT_TYPE_FLOAT:
-			sm_msg("error: no floats in the kernel; invalid format specifier '%.*s'", read, old_fmt);
+			sm_error("no floats in the kernel; invalid format specifier '%.*s'", read, old_fmt);
 			return;
 
 		case FORMAT_TYPE_NRCHARS:
-			sm_msg("error: %%n not supported in kernel");
+			sm_error("%%n not supported in kernel");
 			return;
 
 		case FORMAT_TYPE_WIDTH:
@@ -1177,7 +1177,7 @@ check_printf_call(const char *name, struct expression *callexpr, void *_info)
 	/* Lack of format argument is a bug. */
 	fmtexpr = get_argument_from_call_expr(callexpr->args, fmtidx);
 	if (!fmtexpr) {
-		sm_msg("error: call of '%s' with no format argument", name);
+		sm_error("call of '%s' with no format argument", name);
 		return;
 	}
 
diff --git a/check_locking.c b/check_locking.c
index 711bbc6..06cc7a5 100644
--- a/check_locking.c
+++ b/check_locking.c
@@ -459,7 +459,7 @@ static void do_lock(const char *name)
 		add_tracker(&starts_unlocked, my_id, name, NULL);
 	if (sm && slist_has_state(sm->possible, &locked) &&
 			strcmp(name, "bottom_half:") != 0)
-		sm_msg("error: double lock '%s'", name);
+		sm_error("double lock '%s'", name);
 	if (sm)
 		func_has_transition = TRUE;
 	set_state(my_id, name, NULL, &locked);
@@ -491,7 +491,7 @@ static void do_unlock(const char *name)
 		add_tracker(&starts_locked, my_id, name, NULL);
 	if (sm && slist_has_state(sm->possible, &unlocked) &&
 			strcmp(name, "bottom_half:") != 0)
-		sm_msg("error: double unlock '%s'", name);
+		sm_error("double unlock '%s'", name);
 	if (sm)
 		func_has_transition = TRUE;
 	set_state(my_id, name, NULL, &unlocked);
@@ -852,7 +852,7 @@ static void check_consistency(struct symbol *sym)
 	FOR_EACH_PTR(starts_locked, tmp) {
 		if (in_tracker_list(starts_unlocked, tmp->owner, tmp->name,
 					tmp->sym))
-			sm_msg("error:  locking inconsistency.  We assume "
+			sm_error("locking inconsistency.  We assume "
 				   "'%s' is both locked and unlocked at the "
 				   "start.",
 				tmp->name);
diff --git a/check_memcpy_overflow.c b/check_memcpy_overflow.c
index 578c70f..dddc555 100644
--- a/check_memcpy_overflow.c
+++ b/check_memcpy_overflow.c
@@ -271,7 +271,7 @@ static void match_limited(const char *fn, struct expression *expr, void *_limite
 		return;
 
 	dest_name = expr_to_str(dest);
-	sm_msg("error: %s() '%s' too small (%d vs %s)", fn, dest_name, has, sval_to_str(needed));
+	sm_error("%s() '%s' too small (%d vs %s)", fn, dest_name, has, sval_to_str(needed));
 	free_string(dest_name);
 }
 
diff --git a/check_memory.c b/check_memory.c
index 776d97d..4e27497 100644
--- a/check_memory.c
+++ b/check_memory.c
@@ -201,7 +201,7 @@ static void match_assign(struct expression *expr)
 
 	if (right_name && (state = get_state(my_id, right_name, right_sym))) {
 		if (state == &isfree && !is_complex(right))
-			sm_msg("error: assigning freed pointer '%s'", right_name);
+			sm_error("assigning freed pointer '%s'", right_name);
 		set_state(my_id, right_name, right_sym, &assigned);
 	}
 
@@ -275,7 +275,7 @@ static void check_sm_is_leaked(struct sm_state *sm)
 		!is_null(sm->name, sm->sym) &&
 		!is_argument(sm->sym) && 
 		!parent_is_assigned(sm->sym))
-		sm_msg("error: memory leak of '%s'", sm->name);
+		sm_error("memory leak of '%s'", sm->name);
 }
 
 static void check_tracker_is_leaked(struct tracker *t)
diff --git a/check_memset.c b/check_memset.c
index 75413b8..0213693 100644
--- a/check_memset.c
+++ b/check_memset.c
@@ -32,7 +32,7 @@ static void match_memset(const char *fn, struct expression *expr, void *data)
 		return;
 	if (sval.value != 0)
 		return;
-	sm_msg("error: calling memset(x, y, 0);");
+	sm_error("calling memset(x, y, 0);");
 }
 
 void check_memset(int id)
diff --git a/check_snprintf_overflow.c b/check_snprintf_overflow.c
index 710c7fd..c7adba5 100644
--- a/check_snprintf_overflow.c
+++ b/check_snprintf_overflow.c
@@ -38,7 +38,7 @@ static void match_snprintf(const char *fn, struct expression *expr, void *unused
 	if (!get_implied_value(dest_size_expr, &limit_size))
 		return;
 	if (dest_size && dest_size < limit_size.value)
-		sm_msg("error: snprintf() is printing too much %s vs %d",
+		sm_error("snprintf() is printing too much %s vs %d",
 		       sval_to_str(limit_size), dest_size);
 	format = expr_to_var(format_string);
 	if (!format)
@@ -50,7 +50,7 @@ static void match_snprintf(const char *fn, struct expression *expr, void *unused
 	if (!data_size)
 		data_size = get_array_size_bytes(data);
 	if (limit_size.value < data_size)
-		sm_msg("error: snprintf() chops off the last chars of '%s': %d vs %s",
+		sm_error("snprintf() chops off the last chars of '%s': %d vs %s",
 		       data_name, data_size, sval_to_str(limit_size));
 free:
 	free_string(data_name);
diff --git a/check_sprintf_overflow.c b/check_sprintf_overflow.c
index 5330319..46d9794 100644
--- a/check_sprintf_overflow.c
+++ b/check_sprintf_overflow.c
@@ -44,7 +44,7 @@ static void match_sprintf(const char *fn, struct expression *expr, void *unused)
 	if (!data_size)
 		data_size = get_array_size_bytes(data);
 	if (dest_size < data_size)
-		sm_msg("error: sprintf() copies too much data from '%s': %d vs %d",
+		sm_error("sprintf() copies too much data from '%s': %d vs %d",
 		       data_name, data_size, dest_size);
 free:
 	free_string(data_name);
diff --git a/check_strcpy_overflow.c b/check_strcpy_overflow.c
index cc7784b..00731f9 100644
--- a/check_strcpy_overflow.c
+++ b/check_strcpy_overflow.c
@@ -46,7 +46,7 @@ static void match_strcpy(const char *fn, struct expression *expr, void *unused)
 	data_name = expr_to_str(data);
 
 	if (data_size)
-		sm_msg("error: %s() '%s' too large for '%s' (%d vs %d)",
+		sm_error("%s() '%s' too large for '%s' (%d vs %d)",
 			fn, data_name, dest_name, data_size, dest_size);
 	else if (option_spammy)
 		sm_warning("%s() '%s' of unknown size might be too large for '%s'",
diff --git a/check_string_len.c b/check_string_len.c
index 6a1bcd1..3d6fd7f 100644
--- a/check_string_len.c
+++ b/check_string_len.c
@@ -239,7 +239,7 @@ static void match_not_limited(const char *fn, struct expression *call, void *inf
 			user = 1;
 	} END_FOR_EACH_PTR(arg);
 
-	sm_msg("error: format string overflow. buf_size: %d length: %d%s",
+	sm_error("format string overflow. buf_size: %d length: %d%s",
 	       buf_size, size, user ? " [user data]": "");
 }
 
diff --git a/check_testing_index_after_use.c b/check_testing_index_after_use.c
index 453eb36..18b0fcf 100644
--- a/check_testing_index_after_use.c
+++ b/check_testing_index_after_use.c
@@ -112,7 +112,7 @@ static void match_condition(struct expression *expr)
 			char *name;
 
 			name = expr_to_var(left ? expr->right : expr->left);
-			sm_msg("error: testing array offset '%s' after use.", name);
+			sm_error("testing array offset '%s' after use.", name);
 			return;
 		}
 	} END_FOR_EACH_PTR(tmp);
diff --git a/check_type.c b/check_type.c
index 31f5eed..ac0f5b8 100644
--- a/check_type.c
+++ b/check_type.c
@@ -44,13 +44,13 @@ static void match_free(const char *fn, struct expression *expr, void *data)
 	name = expr_to_str(arg_expr);
 
 	if (!strcmp("sk_buff", type->ident->name)) {
-		sm_msg("error: use kfree_skb() here instead of kfree(%s)", name);
+		sm_error("use kfree_skb() here instead of kfree(%s)", name);
 	} else if (!strcmp("net_device", type->ident->name)) {
 		if (in_function("alloc_netdev"))
 			return;
 		if (in_function("alloc_netdev_mqs"))
 			return;
-		sm_msg("error: use free_netdev() here instead of kfree(%s)", name);
+		sm_error("use free_netdev() here instead of kfree(%s)", name);
 	}
 
 	free_string(name);
diff --git a/check_wait_for_common.c b/check_wait_for_common.c
index bd909c6..8efb457 100644
--- a/check_wait_for_common.c
+++ b/check_wait_for_common.c
@@ -26,7 +26,7 @@ static void match_wait_for_common(const char *fn, struct expression *expr, void
 	if (!expr_unsigned(expr->left))
 		return;
 	name = expr_to_str(expr->left);
-	sm_msg("error: '%s()' returns negative and '%s' is unsigned", fn, name);
+	sm_error("'%s()' returns negative and '%s' is unsigned", fn, name);
 	free_string(name);
 }
 
diff --git a/check_wine_filehandles.c b/check_wine_filehandles.c
index 6f1f92b..c4bf8a7 100644
--- a/check_wine_filehandles.c
+++ b/check_wine_filehandles.c
@@ -73,7 +73,7 @@ static void match_condition(struct expression *expr)
 		char *name;
 
 		name = expr_to_var(expr);
-		sm_msg("error: comparing a filehandle against zero '%s'", name);
+		sm_error("comparing a filehandle against zero '%s'", name);
 		set_state_expr(my_id, expr, &oktocheck);
 		free_string(name);
 	}
-- 
1.8.3.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.