Powered by Linux
[PATCH 1/3] check_kernel_printf: check that %pg gets a block_device — Semantic Matching Tool

[PATCH 1/3] check_kernel_printf: check that %pg gets a block_device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Rasmus Villemoes <rv@xxxxxxxxxxxxxxxxxx>
---
 check_kernel_printf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/check_kernel_printf.c b/check_kernel_printf.c
index d0ca89e..a8eb1d4 100644
--- a/check_kernel_printf.c
+++ b/check_kernel_printf.c
@@ -599,11 +599,15 @@ static void address_val(const char *fmt, struct symbol *type, struct symbol *bas
 
 static void block_device(const char *fmt, struct symbol *type, struct symbol *basetype, int vaidx)
 {
+	const char *tag = "block_device";
+
 	assert(fmt[0] == 'g');
 	if (isalnum(fmt[1])) {
 		sm_msg("warn: %%pg cannot be followed by '%c'", fmt[1]);
-		return;
 	}
+	if (!is_struct_tag(basetype, tag))
+		sm_msg("error: '%%p%c' expects argument of type struct '%s*', argument %d has type '%s'",
+			fmt[0], tag, vaidx, type_to_str(type));
 }
 
 static void flag_string(const char *fmt, struct symbol *type, struct symbol *basetype, int vaidx)
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe smatch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux