2 * Copyright (C) 2015 Rasmus Villemoes.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt
22 #include "smatch_slist.h"
24 #define spam(args...) do { \
32 * Much of this is taken directly from the kernel (mostly vsprintf.c),
33 * with a few modifications here and there.
36 #define KERN_SOH_ASCII '\001'
38 typedef unsigned char u8
;
39 typedef signed short s16
;
41 #define SIGN 1 /* unsigned/signed, must be 1 */
42 #define LEFT 2 /* left justified */
43 #define PLUS 4 /* show plus */
44 #define SPACE 8 /* space if plus */
45 #define ZEROPAD 16 /* pad with zero, must be 16 == '0' - ' ' */
46 #define SMALL 32 /* use lowercase in hex (must be 32 == 0x20) */
47 #define SPECIAL 64 /* prefix hex with "0x", octal with "0" */
50 FORMAT_TYPE_NONE
, /* Just a string part */
52 FORMAT_TYPE_PRECISION
,
56 FORMAT_TYPE_PERCENT_CHAR
,
58 FORMAT_TYPE_LONG_LONG
,
69 FORMAT_TYPE_NRCHARS
, /* Reintroduced for this checker */
70 FORMAT_TYPE_FLOAT
, /* for various floating point formatters */
74 unsigned int type
:8; /* format_type enum */
75 signed int field_width
:24; /* width of output field */
76 unsigned int flags
:8; /* flags to number() */
77 unsigned int base
:8; /* number base, 8, 10 or 16 only */
78 signed int precision
:16; /* # of digits/chars */
80 #define FIELD_WIDTH_MAX ((1 << 23) - 1)
81 #define PRECISION_MAX ((1 << 15) - 1)
82 extern char __check_printf_spec
[1-2*(sizeof(struct printf_spec
) != 8)];
85 skip_atoi(const char **s
)
90 i
= i
*10 + *((*s
)++) - '0';
96 format_decode(const char *fmt
, struct printf_spec
*spec
)
98 const char *start
= fmt
;
101 /* we finished early by reading the field width */
102 if (spec
->type
== FORMAT_TYPE_WIDTH
) {
103 if (spec
->field_width
< 0) {
104 spec
->field_width
= -spec
->field_width
;
107 spec
->type
= FORMAT_TYPE_NONE
;
111 /* we finished early by reading the precision */
112 if (spec
->type
== FORMAT_TYPE_PRECISION
) {
113 if (spec
->precision
< 0)
116 spec
->type
= FORMAT_TYPE_NONE
;
121 spec
->type
= FORMAT_TYPE_NONE
;
123 for (; *fmt
; ++fmt
) {
128 /* Return the current non-format string */
129 if (fmt
!= start
|| !*fmt
)
135 while (1) { /* this also skips first '%' */
141 case '-': spec
->flags
|= LEFT
; break;
142 case '+': spec
->flags
|= PLUS
; break;
143 case ' ': spec
->flags
|= SPACE
; break;
144 case '#': spec
->flags
|= SPECIAL
; break;
145 case '0': spec
->flags
|= ZEROPAD
; break;
146 default: found
= false;
153 /* get field width */
154 spec
->field_width
= -1;
157 spec
->field_width
= skip_atoi(&fmt
);
158 else if (*fmt
== '*') {
159 /* it's the next argument */
160 spec
->type
= FORMAT_TYPE_WIDTH
;
161 return ++fmt
- start
;
165 /* get the precision */
166 spec
->precision
= -1;
170 spec
->precision
= skip_atoi(&fmt
);
171 if (spec
->precision
< 0)
173 } else if (*fmt
== '*') {
174 /* it's the next argument */
175 spec
->type
= FORMAT_TYPE_PRECISION
;
176 return ++fmt
- start
;
181 /* get the conversion qualifier */
183 if (*fmt
== 'h' || _tolower(*fmt
) == 'l' ||
184 _tolower(*fmt
) == 'z' || *fmt
== 't') {
186 if (qualifier
== *fmt
) {
187 if (qualifier
== 'l') {
190 } else if (qualifier
== 'h') {
194 sm_msg("warn: invalid repeated qualifier '%c'", *fmt
);
204 sm_msg("warn: qualifier '%c' ignored for %%c specifier", qualifier
);
206 spec
->type
= FORMAT_TYPE_CHAR
;
207 return ++fmt
- start
;
211 sm_msg("warn: qualifier '%c' ignored for %%s specifier", qualifier
);
213 spec
->type
= FORMAT_TYPE_STR
;
214 return ++fmt
- start
;
217 spec
->type
= FORMAT_TYPE_PTR
;
218 return ++fmt
- start
;
221 spec
->type
= FORMAT_TYPE_PERCENT_CHAR
;
222 return ++fmt
- start
;
224 /* integer number formats - set up the flags and "break" */
230 spec
->flags
|= SMALL
;
243 spec
->type
= FORMAT_TYPE_NRCHARS
;
244 return ++fmt
- start
;
250 spec
->type
= FORMAT_TYPE_FLOAT
;
251 return ++fmt
- start
;
254 spec
->type
= FORMAT_TYPE_INVALID
;
255 /* Unlike the kernel code, we 'consume' the invalid
256 * character so that it can get included in the
257 * report. After that, we bail out. */
258 return ++fmt
- start
;
261 if (qualifier
== 'L')
262 spec
->type
= FORMAT_TYPE_LONG_LONG
;
263 else if (qualifier
== 'l') {
264 if (spec
->flags
& SIGN
)
265 spec
->type
= FORMAT_TYPE_LONG
;
267 spec
->type
= FORMAT_TYPE_ULONG
;
268 } else if (_tolower(qualifier
) == 'z') {
269 spec
->type
= FORMAT_TYPE_SIZE_T
;
270 } else if (qualifier
== 't') {
271 spec
->type
= FORMAT_TYPE_PTRDIFF
;
272 } else if (qualifier
== 'H') {
273 if (spec
->flags
& SIGN
)
274 spec
->type
= FORMAT_TYPE_BYTE
;
276 spec
->type
= FORMAT_TYPE_UBYTE
;
277 } else if (qualifier
== 'h') {
278 if (spec
->flags
& SIGN
)
279 spec
->type
= FORMAT_TYPE_SHORT
;
281 spec
->type
= FORMAT_TYPE_USHORT
;
283 if (spec
->flags
& SIGN
)
284 spec
->type
= FORMAT_TYPE_INT
;
286 spec
->type
= FORMAT_TYPE_UINT
;
289 return ++fmt
- start
;
292 static int is_struct_tag(struct symbol
*type
, const char *tag
)
294 return type
->type
== SYM_STRUCT
&& type
->ident
&& !strcmp(type
->ident
->name
, tag
);
297 static int has_struct_tag(struct symbol
*type
, const char *tag
)
301 if (type
->type
== SYM_STRUCT
)
302 return is_struct_tag(type
, tag
);
303 if (type
->type
== SYM_UNION
) {
304 FOR_EACH_PTR(type
->symbol_list
, tmp
) {
305 tmp
= get_real_base_type(tmp
);
306 if (tmp
&& is_struct_tag(tmp
, tag
))
308 } END_FOR_EACH_PTR(tmp
);
313 static int is_char_type(struct symbol
*type
)
315 return type
== &uchar_ctype
|| type
== &char_ctype
|| type
== &schar_ctype
;
319 * I have absolutely no idea if this is how one is supposed to get the
320 * symbol representing a typedef, but it seems to work.
322 struct typedef_lookup
{
328 static struct symbol
*_typedef_lookup(const char *name
)
333 id
= built_in_ident(name
);
336 node
= lookup_symbol(id
, NS_TYPEDEF
);
337 if (!node
|| node
->type
!= SYM_NODE
)
339 return node
->ctype
.base_type
;
342 static void typedef_lookup(struct typedef_lookup
*tl
)
344 if (tl
->sym
|| tl
->failed
)
346 tl
->sym
= _typedef_lookup(tl
->name
);
348 sm_msg("internal error: could not find typedef '%s'", tl
->name
);
354 static void ip4(const char *fmt
, struct symbol
*type
, struct symbol
*basetype
, int vaidx
)
356 enum { ENDIAN_BIG
, ENDIAN_LITTLE
, ENDIAN_HOST
} endian
= ENDIAN_BIG
;
358 assert(fmt
[0] == 'i' || fmt
[0] == 'I');
359 assert(fmt
[1] == '4');
361 if (isalnum(fmt
[2])) {
364 endian
= ENDIAN_HOST
;
367 endian
= ENDIAN_LITTLE
;
374 sm_msg("warn: '%%p%c4' can only be followed by one of [hnbl], not '%c'", fmt
[0], fmt
[2]);
377 sm_msg("warn: '%%p%c4' can only be followed by precisely one of [hnbl]", fmt
[0]);
381 if (type
->ctype
.modifiers
& MOD_NODEREF
)
382 sm_msg("error: passing __user pointer to '%%p%c4'", fmt
[0]);
385 * If we have a pointer to char/u8/s8, we expect the caller to
386 * handle endianness; I don't think there's anything we can
387 * do. I'd like to check that if we're passed a pointer to a
388 * __bitwise u32 (most likely a __be32), we should have endian
389 * == ENDIAN_BIG. But I can't figure out how to get that
390 * information (it also seems to require ensuring certain
391 * macros are defined). But struct in_addr certainly consists
392 * of only a single __be32, so in that case we can do a check.
394 if (is_char_type(basetype
))
397 if (is_struct_tag(basetype
, "in_addr") && endian
!= ENDIAN_BIG
)
398 sm_msg("warn: passing struct in_addr* to '%%p%c4%c', is the endianness ok?", fmt
[0], fmt
[2]);
403 static void ip6(const char *fmt
, struct symbol
*type
, struct symbol
*basetype
, int vaidx
)
405 assert(fmt
[0] == 'i' || fmt
[0] == 'I');
406 assert(fmt
[1] == '6');
408 if (isalnum(fmt
[2])) {
410 sm_msg("warn: '%%p%c6' can only be followed by c", fmt
[0]);
411 else if (fmt
[0] == 'i')
412 sm_msg("warn: '%%pi6' does not allow flag c");
414 sm_msg("warn: '%%p%c6%c' cannot be followed by other alphanumerics", fmt
[0], fmt
[2]);
417 if (type
->ctype
.modifiers
& MOD_NODEREF
)
418 sm_msg("error: passing __user pointer to '%%p%c6'", fmt
[0]);
421 static void ipS(const char *fmt
, struct symbol
*type
, struct symbol
*basetype
, int vaidx
)
425 assert(tolower(fmt
[0]) == 'i');
426 assert(fmt
[1] == 'S');
428 for (f
= fmt
+2; isalnum(*f
); ++f
) {
429 /* It's probably too anal checking for duplicate flags. */
430 if (!strchr("pfschnbl", *f
))
431 sm_msg("warn: '%%p%cS' cannot be followed by '%c'", fmt
[0], *f
);
435 * XXX: Should we also allow passing a pointer to a union, one
436 * member of which is a struct sockaddr? It may be slightly
437 * cleaner actually passing &u.raw instead of just &u, though
438 * the generated code is of course exactly the same. For now,
439 * we do accept struct sockaddr_in and struct sockaddr_in6,
440 * since those are easy to handle and rather harmless.
442 if (!has_struct_tag(basetype
, "sockaddr") &&
443 !has_struct_tag(basetype
, "sockaddr_in") &&
444 !has_struct_tag(basetype
, "sockaddr_in6") &&
445 !has_struct_tag(basetype
, "__kernel_sockaddr_storage"))
446 sm_msg("error: '%%p%cS' expects argument of type struct sockaddr *, "
447 "argument %d has type '%s'", fmt
[0], vaidx
, type_to_str(type
));
450 static void hex_string(const char *fmt
, struct symbol
*type
, struct symbol
*basetype
, int vaidx
)
452 assert(fmt
[0] == 'h');
453 if (isalnum(fmt
[1])) {
454 if (!strchr("CDN", fmt
[1]))
455 sm_msg("warn: '%%ph' cannot be followed by '%c'", fmt
[1]);
457 sm_msg("warn: '%%ph' can be followed by at most one of [CDN], and no other alphanumerics");
459 if (type
->ctype
.modifiers
& MOD_NODEREF
)
460 sm_msg("error: passing __user pointer to %%ph");
463 static void escaped_string(const char *fmt
, struct symbol
*type
, struct symbol
*basetype
, int vaidx
)
465 assert(fmt
[0] == 'E');
466 while (isalnum(*++fmt
)) {
467 if (!strchr("achnops", *fmt
))
468 sm_msg("warn: %%pE can only be followed by a combination of [achnops]");
470 if (type
->ctype
.modifiers
& MOD_NODEREF
)
471 sm_msg("error: passing __user pointer to %%pE");
474 static void resource_string(const char *fmt
, struct symbol
*type
, struct symbol
*basetype
, int vaidx
)
476 assert(tolower(fmt
[0]) == 'r');
477 if (!is_struct_tag(basetype
, "resource")) {
478 sm_msg("error: '%%p%c' expects argument of type struct resource *, "
479 "but argument %d has type '%s'", fmt
[0], vaidx
, type_to_str(type
));
482 sm_msg("warn: '%%p%c' cannot be followed by '%c'", fmt
[0], fmt
[1]);
485 static void mac_address_string(const char *fmt
, struct symbol
*type
, struct symbol
*basetype
, int vaidx
)
487 assert(tolower(fmt
[0]) == 'm');
488 if (isalnum(fmt
[1])) {
489 if (!(fmt
[1] == 'F' || fmt
[1] == 'R'))
490 sm_msg("warn: '%%p%c' cannot be followed by '%c'", fmt
[0], fmt
[1]);
491 if (fmt
[0] == 'm' && fmt
[1] == 'F')
492 sm_msg("warn: it is pointless to pass flag F to %%pm");
494 sm_msg("warn: '%%p%c%c' cannot be followed by other alphanumeric", fmt
[0], fmt
[1]);
496 /* Technically, bdaddr_t is a typedef for an anonymous struct, but this still seems to work. */
497 if (!is_char_type(basetype
) && !is_struct_tag(basetype
, "bdaddr_t") && basetype
!= &void_ctype
) {
498 sm_msg("warn: '%%p%c' expects argument of type u8 * or bdaddr_t *, argument %d has type '%s'",
499 fmt
[0], vaidx
, type_to_str(type
));
501 if (type
->ctype
.modifiers
& MOD_NODEREF
)
502 sm_msg("error: passing __user pointer to '%%p%c'", fmt
[0]);
505 static void dentry_file(const char *fmt
, struct symbol
*type
, struct symbol
*basetype
, int vaidx
)
509 assert(tolower(fmt
[0]) == 'd');
510 tag
= fmt
[0] == 'd' ? "dentry" : "file";
512 if (isalnum(fmt
[1])) {
513 if (!strchr("234", fmt
[1]))
514 sm_msg("warn: '%%p%c' can only be followed by one of [234]", fmt
[0]);
516 sm_msg("warn: '%%p%c%c' cannot be followed by '%c'", fmt
[0], fmt
[1], fmt
[2]);
519 if (!is_struct_tag(basetype
, tag
))
520 sm_msg("error: '%%p%c' expects argument of type struct '%s*', argument %d has type '%s'",
521 fmt
[0], tag
, vaidx
, type_to_str(type
));
524 static void clock(const char *fmt
, struct symbol
*type
, struct symbol
*basetype
, int vaidx
)
526 assert(fmt
[0] == 'C');
527 if (isalnum(fmt
[1])) {
528 if (!strchr("nr", fmt
[1]))
529 sm_msg("warn: '%%pC' can only be followed by one of [nr]");
531 sm_msg("warn: '%%pC%c' cannot be followed by '%c'", fmt
[1], fmt
[2]);
533 if (!is_struct_tag(basetype
, "clk"))
534 sm_msg("error: '%%pC' expects argument of type 'struct clk*', argument %d has type '%s'",
535 vaidx
, type_to_str(type
));
538 static void va_format(const char *fmt
, struct symbol
*type
, struct symbol
*basetype
, int vaidx
)
540 assert(fmt
[0] == 'V');
542 sm_msg("warn: %%pV cannot be followed by any alphanumerics");
543 if (!is_struct_tag(basetype
, "va_format"))
544 sm_msg("error: %%pV expects argument of type struct va_format*, argument %d has type '%s'", vaidx
, type_to_str(type
));
547 static void netdev_feature(const char *fmt
, struct symbol
*type
, struct symbol
*basetype
, int vaidx
)
549 static struct typedef_lookup netdev
= { .name
= "netdev_features_t" };
551 assert(fmt
[0] == 'N');
553 sm_msg("error: %%pN must be followed by 'F'");
557 sm_msg("warn: %%pNF cannot be followed by '%c'", fmt
[2]);
559 typedef_lookup(&netdev
);
562 if (basetype
!= netdev
.sym
)
563 sm_msg("error: %%pNF expects argument of type netdev_features_t*, argument %d has type '%s'",
564 vaidx
, type_to_str(type
));
567 static void address_val(const char *fmt
, struct symbol
*type
, struct symbol
*basetype
, int vaidx
)
569 static struct typedef_lookup dma
= { .name
= "dma_addr_t" };
570 static struct typedef_lookup phys
= { .name
= "phys_addr_t" };
571 struct typedef_lookup
*which
= &phys
;
572 const char *suf
= "";
573 assert(fmt
[0] == 'a');
575 if (isalnum(fmt
[1])) {
585 sm_msg("error: '%%pa' can only be followed by one of [dp]");
588 sm_msg("error: '%%pa%c' cannot be followed by '%c'", fmt
[1], fmt
[2]);
591 typedef_lookup(which
);
594 if (basetype
!= which
->sym
) {
595 sm_msg("error: '%%pa%s' expects argument of type '%s*', argument %d has type '%s'",
596 suf
, which
->name
, vaidx
, type_to_str(type
));
601 pointer(const char *fmt
, struct expression
*arg
, int vaidx
)
603 struct symbol
*type
, *basetype
;
605 type
= get_type(arg
);
607 sm_msg("warn: could not determine type of argument %d", vaidx
);
610 if (!is_ptr_type(type
)) {
611 sm_msg("error: %%p expects pointer argument, but argument %d has type '%s'",
612 vaidx
, type_to_str(type
));
615 /* Just plain %p, nothing to check. */
619 basetype
= get_real_base_type(type
);
621 * Passing a pointer-to-array is harmless, but most likely one
622 * meant to pass pointer-to-first-element. If basetype is
623 * array type, we issue a notice and "dereference" the types
626 if (basetype
->type
== SYM_ARRAY
) {
627 spam("note: passing pointer-to-array; is the address-of redundant?");
629 basetype
= get_real_base_type(type
);
633 * We pass both the type and the basetype to the helpers. If,
634 * for example, the pointer is really a decayed array which is
635 * passed to %pI4, we might want to check that it is in fact
636 * an array of four bytes. But most are probably only
637 * interested in whether the basetype makes sense. Also, the
638 * pointer may carry some annotation such as __user which
639 * might be worth checking in the handlers which actually
640 * dereference the pointer.
650 /* Can we do anything sensible? Check that the arg is a function pointer, for example? */
655 resource_string(fmt
, type
, basetype
, vaidx
);
659 mac_address_string(fmt
, type
, basetype
, vaidx
);
665 ip4(fmt
, type
, basetype
, vaidx
);
668 ip6(fmt
, type
, basetype
, vaidx
);
671 ipS(fmt
, type
, basetype
, vaidx
);
674 sm_msg("warn: '%%p%c' must be followed by one of [46S]", fmt
[0]);
679 * %pE and %ph can handle any valid pointer. We still check
680 * whether all the subsequent alphanumerics are valid for the
681 * particular %pX conversion.
684 escaped_string(fmt
, type
, basetype
, vaidx
);
687 hex_string(fmt
, type
, basetype
, vaidx
);
692 va_format(fmt
, type
, basetype
, vaidx
);
697 netdev_feature(fmt
, type
, basetype
, vaidx
);
700 address_val(fmt
, type
, basetype
, vaidx
);
704 dentry_file(fmt
, type
, basetype
, vaidx
);
707 clock(fmt
, type
, basetype
, vaidx
);
710 sm_msg("error: unrecognized %%p extension '%c', treated as normal %%p", *fmt
);
715 * A common error is to pass a "char" or "signed char" to %02x (or
716 * %.2X or some other variant). This can actually be a security
717 * problem, because a lot of code expects this to produce exactly two
718 * characters of output. Unfortunately this also produces false
719 * positives, since we're sometimes in arch-specific code on an arch
720 * where char is always unsigned.
723 hexbyte(const char *fmt
, int fmt_len
, struct expression
*arg
, int vaidx
, struct printf_spec spec
)
728 * For now, just check the most common and obvious, which is
729 * roughly %[.0]2[xX].
731 if (spec
.field_width
!= 2 && spec
.precision
!= 2)
736 type
= get_type(arg
);
738 sm_msg("warn: could not determine type of argument %d", vaidx
);
741 if (type
== &char_ctype
|| type
== &schar_ctype
)
742 sm_msg("warn: argument %d to %.*s specifier has type '%s'",
743 vaidx
, fmt_len
, fmt
, type_to_str(type
));
747 check_format_string(const char *fmt
, const char *caller
)
751 for (f
= fmt
; *f
; ++f
) {
752 unsigned char c
= *f
;
756 * This typically arises from bad conversion
757 * to pr_*, e.g. pr_warn(KERN_WARNING "something").
760 sm_msg("warn: KERN_* level not at start of string");
762 * In a very few cases, the level is actually
763 * computed and passed via %c, as in KERN_SOH
764 * "%c...". printk explicitly supports
767 if (!(('0' <= f
[1] && f
[1] <= '7') ||
769 (f
[1] == '%' && f
[2] == 'c')))
770 sm_msg("warn: invalid KERN_* level: KERN_SOH_ASCII followed by '\\x%02x'", (unsigned char)f
[1]);
778 sm_msg("warn: format string contains non-ascii character '\\x%02x'", c
);
785 sm_msg("warn: format string contains unusual character '\\x%02x'", c
);
790 f
= strstr(fmt
, caller
);
791 if (f
&& strstr(f
+1, caller
))
792 sm_msg("note: format string contains name of enclosing function '%s' twice", caller
);
797 static int arg_is___func__(struct expression
*arg
)
799 if (arg
->type
!= EXPR_SYMBOL
)
801 return !strcmp(arg
->symbol_name
->name
, "__func__") ||
802 !strcmp(arg
->symbol_name
->name
, "__FUNCTION__") ||
803 !strcmp(arg
->symbol_name
->name
, "__PRETTY_FUNCTION__");
805 static int arg_contains_caller(struct expression
*arg
, const char *caller
)
807 if (arg
->type
!= EXPR_STRING
)
809 return strstr(arg
->string
->data
, caller
) != NULL
;
812 static int is_array_of_const_char(struct symbol
*sym
)
814 struct symbol
*base
= sym
->ctype
.base_type
;
815 if (base
->type
!= SYM_ARRAY
)
817 if (!(base
->ctype
.modifiers
& MOD_CONST
))
819 if (!is_char_type(base
->ctype
.base_type
)) {
820 spam("weird: format argument is array of const '%s'", type_to_str(base
->ctype
.base_type
));
826 static int is_const_pointer_to_const_char(struct symbol
*sym
)
828 struct symbol
*base
= sym
->ctype
.base_type
;
829 if (!(sym
->ctype
.modifiers
& MOD_CONST
))
831 if (base
->type
!= SYM_PTR
)
833 if (!(base
->ctype
.modifiers
& MOD_CONST
))
835 if (!is_char_type(base
->ctype
.base_type
)) {
836 spam("weird: format argument is pointer to const '%s'", type_to_str(base
->ctype
.base_type
));
842 static int unknown_format(struct expression
*expr
)
844 struct state_list
*slist
;
846 slist
= get_strings(expr
);
849 if (slist_has_state(slist
, &undefined
))
855 static bool has_hex_prefix(const char *orig_fmt
, const char *old_fmt
)
857 return old_fmt
>= orig_fmt
+ 2 &&
858 old_fmt
[-2] == '0' && _tolower(old_fmt
[-1]) == 'x';
861 static bool is_integer_specifier(int type
)
864 case FORMAT_TYPE_LONG_LONG
:
865 case FORMAT_TYPE_ULONG
:
866 case FORMAT_TYPE_LONG
:
867 case FORMAT_TYPE_UBYTE
:
868 case FORMAT_TYPE_BYTE
:
869 case FORMAT_TYPE_USHORT
:
870 case FORMAT_TYPE_SHORT
:
871 case FORMAT_TYPE_UINT
:
872 case FORMAT_TYPE_INT
:
873 case FORMAT_TYPE_SIZE_T
:
874 case FORMAT_TYPE_PTRDIFF
:
883 do_check_printf_call(const char *caller
, const char *name
, struct expression
*callexpr
, struct expression
*fmtexpr
, int vaidx
)
885 struct printf_spec spec
= {0};
886 const char *fmt
, *orig_fmt
;
889 fmtexpr
= strip_parens(fmtexpr
);
890 if (fmtexpr
->type
== EXPR_CONDITIONAL
) {
891 do_check_printf_call(caller
, name
, callexpr
, fmtexpr
->cond_true
? : fmtexpr
->conditional
, vaidx
);
892 do_check_printf_call(caller
, name
, callexpr
, fmtexpr
->cond_false
, vaidx
);
895 if (fmtexpr
->type
== EXPR_SYMBOL
) {
897 * If the symbol has an initializer, we can handle
899 * const char foo[] = "abc"; and
900 * const char * const foo = "abc";
902 * We simply replace fmtexpr with the initializer
903 * expression. If foo is not one of the above, or if
904 * the initializer expression is somehow not a string
905 * literal, fmtexpr->type != EXPR_STRING will trigger
906 * below and we'll spam+return.
908 struct symbol
*sym
= fmtexpr
->symbol
;
909 if (sym
->initializer
&&
910 (is_array_of_const_char(sym
) ||
911 is_const_pointer_to_const_char(sym
))) {
912 fmtexpr
= strip_parens(sym
->initializer
);
916 if (fmtexpr
->type
!= EXPR_STRING
) {
917 if (!unknown_format(fmtexpr
))
920 * Since we're now handling both ?: and static const
921 * char[] arguments, we don't get as much noise. It's
922 * still spammy, though.
924 spam("warn: call of '%s' with non-constant format argument", name
);
928 orig_fmt
= fmt
= fmtexpr
->string
->data
;
929 caller_in_fmt
= check_format_string(fmt
, caller
);
932 const char *old_fmt
= fmt
;
933 int read
= format_decode(fmt
, &spec
);
934 struct expression
*arg
;
937 if (spec
.type
== FORMAT_TYPE_NONE
||
938 spec
.type
== FORMAT_TYPE_PERCENT_CHAR
)
942 * vaidx is currently the correct 0-based index for
943 * get_argument_from_call_expr. We post-increment it
944 * here so that it is the correct 1-based index for
945 * all the handlers below. This of course requires
946 * that we handle all FORMAT_TYPE_* things not taking
949 arg
= get_argument_from_call_expr(callexpr
->args
, vaidx
++);
951 if (spec
.flags
& SPECIAL
&& has_hex_prefix(orig_fmt
, old_fmt
))
952 sm_msg("warn: '%.2s' prefix is redundant when # flag is used", old_fmt
-2);
953 if (is_integer_specifier(spec
.type
) && spec
.base
!= 16 && has_hex_prefix(orig_fmt
, old_fmt
))
954 sm_msg("warn: '%.2s' prefix is confusing together with '%.*s' specifier",
955 old_fmt
-2, (int)(fmt
-old_fmt
), old_fmt
);
958 /* case FORMAT_TYPE_NONE: */
959 /* case FORMAT_TYPE_PERCENT_CHAR: */
962 case FORMAT_TYPE_INVALID
:
963 sm_msg("error: format specifier '%.*s' invalid", read
, old_fmt
);
966 case FORMAT_TYPE_FLOAT
:
967 sm_msg("error: no floats in the kernel; invalid format specifier '%.*s'", read
, old_fmt
);
970 case FORMAT_TYPE_NRCHARS
:
971 sm_msg("error: %%n not supported in kernel");
974 case FORMAT_TYPE_WIDTH
:
975 case FORMAT_TYPE_PRECISION
:
976 /* check int argument */
979 case FORMAT_TYPE_STR
:
981 * If the format string already contains the
982 * function name, it probably doesn't make
983 * sense to pass __func__ as well (or rather
984 * vice versa: If pr_fmt(fmt) has been defined
985 * to '"%s: " fmt, __func__', it doesn't make
986 * sense to use a format string containing the
989 * This produces a lot of hits. They are not
990 * false positives, but it is easier to handle
991 * the things which don't occur that often
992 * first, so we use spam().
995 if (arg_is___func__(arg
))
996 spam("warn: passing __func__ while the format string already contains the name of the function '%s'",
998 else if (arg_contains_caller(arg
, caller
))
999 sm_msg("warn: passing string constant '%s' containing '%s' which is already part of the format string",
1000 arg
->string
->data
, caller
);
1004 case FORMAT_TYPE_PTR
:
1005 /* This is the most important part: Checking %p extensions. */
1006 pointer(fmt
, arg
, vaidx
);
1007 while (isalnum(*fmt
))
1011 case FORMAT_TYPE_CHAR
:
1013 case FORMAT_TYPE_UBYTE
:
1014 case FORMAT_TYPE_BYTE
:
1015 case FORMAT_TYPE_USHORT
:
1016 case FORMAT_TYPE_SHORT
:
1017 case FORMAT_TYPE_INT
:
1018 /* argument should have integer type of width <= sizeof(int) */
1021 case FORMAT_TYPE_UINT
:
1022 hexbyte(old_fmt
, fmt
-old_fmt
, arg
, vaidx
, spec
);
1023 case FORMAT_TYPE_LONG
:
1024 case FORMAT_TYPE_ULONG
:
1025 case FORMAT_TYPE_LONG_LONG
:
1026 case FORMAT_TYPE_PTRDIFF
:
1027 case FORMAT_TYPE_SIZE_T
:
1034 if (get_argument_from_call_expr(callexpr
->args
, vaidx
))
1035 sm_msg("warn: excess argument passed to '%s'", name
);
1041 check_printf_call(const char *name
, struct expression
*callexpr
, void *_info
)
1044 * Note: attribute(printf) uses 1-based indexing, but
1045 * get_argument_from_call_expr() uses 0-based indexing.
1047 int info
= PTR_INT(_info
);
1048 int fmtidx
= (info
& 0xff) - 1;
1049 int vaidx
= ((info
>> 8) & 0xff) - 1;
1050 struct expression
*fmtexpr
;
1051 const char *caller
= get_function();
1054 * Calling a v*printf function with a literal format arg is
1055 * extremely rare, so we don't bother doing the only checking
1056 * we could do, namely checking that the format string is
1063 * For the things we use the name of the calling function for,
1064 * it is more appropriate to skip a potential SyS_ prefix; the
1065 * same goes for leading underscores.
1067 if (!strncmp(caller
, "SyS_", 4))
1069 while (*caller
== '_')
1072 /* Lack of format argument is a bug. */
1073 fmtexpr
= get_argument_from_call_expr(callexpr
->args
, fmtidx
);
1075 sm_msg("error: call of '%s' with no format argument", name
);
1079 do_check_printf_call(caller
, name
, callexpr
, fmtexpr
, vaidx
);
1083 void check_kernel_printf(int id
)
1085 if (option_project
!= PROJ_KERNEL
)
1090 #define printf_hook(func, fmt, first_to_check) \
1091 add_function_hook(#func, check_printf_call, INT_PTR(fmt + (first_to_check << 8)))
1093 /* Extracted using stupid perl script. */
1096 printf_hook(srm_printk
, 1, 2); /* arch/alpha/include/asm/console.h */
1097 printf_hook(die_if_kernel
, 1, 2); /* arch/frv/include/asm/bug.h */
1098 printf_hook(ia64_mca_printk
, 1, 2); /* arch/ia64/include/asm/mca.h */
1099 printf_hook(nfprint
, 1, 2); /* arch/m68k/include/asm/natfeat.h */
1100 printf_hook(gdbstub_printk
, 1, 2); /* arch/mn10300/include/asm/gdb-stub.h */
1101 printf_hook(DBG
, 1, 2); /* arch/powerpc/boot/ps3.c */
1102 printf_hook(printf
, 1, 2); /* arch/powerpc/boot/stdio.h */
1103 printf_hook(udbg_printf
, 1, 2); /* arch/powerpc/include/asm/udbg.h */
1104 printf_hook(__debug_sprintf_event
, 3, 4); /* arch/s390/include/asm/debug.h */
1105 printf_hook(__debug_sprintf_exception
, 3, 4); /* arch/s390/include/asm/debug.h */
1106 printf_hook(prom_printf
, 1, 2); /* arch/sparc/include/asm/oplib_32.h */
1108 printf_hook(fail
, 1, 2); /* arch/x86/vdso/vdso2c.c */
1111 printf_hook(_ldm_printk
, 3, 4); /* block/partitions/ldm.c */
1112 printf_hook(rbd_warn
, 2, 3); /* drivers/block/rbd.c */
1113 printf_hook(fw_err
, 2, 3); /* drivers/firewire/core.h */
1114 printf_hook(fw_notice
, 2, 3); /* drivers/firewire/core.h */
1115 printf_hook(i915_error_printf
, 2, 3); /* drivers/gpu/drm/i915/i915_drv.h */
1116 printf_hook(i915_handle_error
, 3, 4); /* drivers/gpu/drm/i915/i915_drv.h */
1117 printf_hook(nv_printk_
, 3, 4); /* drivers/gpu/drm/nouveau/core/include/core/printk.h */
1118 printf_hook(host1x_debug_output
, 2, 3); /* drivers/gpu/host1x/debug.h */
1119 printf_hook(callc_debug
, 2, 3); /* drivers/isdn/hisax/callc.c */
1120 printf_hook(link_debug
, 3, 4); /* drivers/isdn/hisax/callc.c */
1121 printf_hook(HiSax_putstatus
, 3, 4); /* drivers/isdn/hisax/hisax.h */
1122 printf_hook(VHiSax_putstatus
, 3, 0); /* drivers/isdn/hisax/hisax.h */
1123 printf_hook(debugl1
, 2, 3); /* drivers/isdn/hisax/isdnl1.h */
1124 printf_hook(l3m_debug
, 2, 3); /* drivers/isdn/hisax/isdnl3.c */
1125 printf_hook(dout_debug
, 2, 3); /* drivers/isdn/hisax/st5481_d.c */
1126 printf_hook(l1m_debug
, 2, 3); /* drivers/isdn/hisax/st5481_d.c */
1127 printf_hook(bch_cache_set_error
, 2, 3); /* drivers/md/bcache/bcache.h */
1128 printf_hook(_tda_printk
, 4, 5); /* drivers/media/tuners/tda18271-priv.h */
1129 printf_hook(i40evf_debug_d
, 3, 4); /* drivers/net/ethernet/intel/i40evf/i40e_osdep.h */
1130 printf_hook(en_print
, 3, 4); /* drivers/net/ethernet/mellanox/mlx4/mlx4_en.h */
1131 printf_hook(_ath_dbg
, 3, 4); /* drivers/net/wireless/ath/ath.h */
1132 printf_hook(ath_printk
, 3, 4); /* drivers/net/wireless/ath/ath.h */
1133 printf_hook(ath10k_dbg
, 3, 4); /* drivers/net/wireless/ath/ath10k/debug.h */
1134 printf_hook(ath10k_err
, 2, 3); /* drivers/net/wireless/ath/ath10k/debug.h */
1135 printf_hook(ath10k_info
, 2, 3); /* drivers/net/wireless/ath/ath10k/debug.h */
1136 printf_hook(ath10k_warn
, 2, 3); /* drivers/net/wireless/ath/ath10k/debug.h */
1137 printf_hook(_ath5k_printk
, 3, 4); /* drivers/net/wireless/ath/ath5k/ath5k.h */
1138 printf_hook(ATH5K_DBG
, 3, 4); /* drivers/net/wireless/ath/ath5k/debug.h */
1139 printf_hook(ATH5K_DBG_UNLIMIT
, 3, 4); /* drivers/net/wireless/ath/ath5k/debug.h */
1140 printf_hook(ath6kl_printk
, 2, 3); /* drivers/net/wireless/ath/ath6kl/common.h */
1141 printf_hook(ath6kl_err
, 1, 2); /* drivers/net/wireless/ath/ath6kl/debug.h */
1142 printf_hook(ath6kl_info
, 1, 2); /* drivers/net/wireless/ath/ath6kl/debug.h */
1143 printf_hook(ath6kl_warn
, 1, 2); /* drivers/net/wireless/ath/ath6kl/debug.h */
1144 printf_hook(wil_dbg_trace
, 2, 3); /* drivers/net/wireless/ath/wil6210/wil6210.h */
1145 printf_hook(wil_err
, 2, 3); /* drivers/net/wireless/ath/wil6210/wil6210.h */
1146 printf_hook(wil_err_ratelimited
, 2, 3); /* drivers/net/wireless/ath/wil6210/wil6210.h */
1147 printf_hook(wil_info
, 2, 3); /* drivers/net/wireless/ath/wil6210/wil6210.h */
1148 printf_hook(b43dbg
, 2, 3); /* drivers/net/wireless/b43/b43.h */
1149 printf_hook(b43err
, 2, 3); /* drivers/net/wireless/b43/b43.h */
1150 printf_hook(b43info
, 2, 3); /* drivers/net/wireless/b43/b43.h */
1151 printf_hook(b43warn
, 2, 3); /* drivers/net/wireless/b43/b43.h */
1152 printf_hook(b43legacydbg
, 2, 3); /* drivers/net/wireless/b43legacy/b43legacy.h */
1153 printf_hook(b43legacyerr
, 2, 3); /* drivers/net/wireless/b43legacy/b43legacy.h */
1154 printf_hook(b43legacyinfo
, 2, 3); /* drivers/net/wireless/b43legacy/b43legacy.h */
1155 printf_hook(b43legacywarn
, 2, 3); /* drivers/net/wireless/b43legacy/b43legacy.h */
1156 printf_hook(__brcmf_dbg
, 3, 4); /* drivers/net/wireless/brcm80211/brcmfmac/debug.h */
1157 printf_hook(__brcmf_err
, 2, 3); /* drivers/net/wireless/brcm80211/brcmfmac/debug.h */
1158 printf_hook(__brcms_crit
, 2, 3); /* drivers/net/wireless/brcm80211/brcmsmac/debug.h */
1159 printf_hook(__brcms_dbg
, 4, 5); /* drivers/net/wireless/brcm80211/brcmsmac/debug.h */
1160 printf_hook(__brcms_err
, 2, 3); /* drivers/net/wireless/brcm80211/brcmsmac/debug.h */
1161 printf_hook(__brcms_info
, 2, 3); /* drivers/net/wireless/brcm80211/brcmsmac/debug.h */
1162 printf_hook(__brcms_warn
, 2, 3); /* drivers/net/wireless/brcm80211/brcmsmac/debug.h */
1163 printf_hook(brcmu_dbg_hex_dump
, 3, 4); /* drivers/net/wireless/brcm80211/include/brcmu_utils.h */
1164 printf_hook(__iwl_crit
, 2, 3); /* drivers/net/wireless/iwlwifi/iwl-debug.h */
1165 printf_hook(__iwl_dbg
, 5, 6); /* drivers/net/wireless/iwlwifi/iwl-debug.h */
1166 printf_hook(__iwl_err
, 4, 5); /* drivers/net/wireless/iwlwifi/iwl-debug.h */
1167 printf_hook(__iwl_info
, 2, 3); /* drivers/net/wireless/iwlwifi/iwl-debug.h */
1168 printf_hook(__iwl_warn
, 2, 3); /* drivers/net/wireless/iwlwifi/iwl-debug.h */
1169 printf_hook(rsi_dbg
, 2, 3); /* drivers/net/wireless/rsi/rsi_main.h */
1170 printf_hook(RTPRINT
, 4, 5); /* drivers/net/wireless/rtlwifi/debug.h */
1171 printf_hook(RT_ASSERT
, 2, 3); /* drivers/net/wireless/rtlwifi/debug.h */
1172 printf_hook(RT_TRACE
, 4, 5); /* drivers/net/wireless/rtlwifi/debug.h */
1173 printf_hook(__of_node_dup
, 2, 3); /* drivers/of/of_private.h */
1174 printf_hook(BNX2FC_HBA_DBG
, 2, 3); /* drivers/scsi/bnx2fc/bnx2fc_debug.h */
1175 printf_hook(BNX2FC_IO_DBG
, 2, 3); /* drivers/scsi/bnx2fc/bnx2fc_debug.h */
1176 printf_hook(BNX2FC_TGT_DBG
, 2, 3); /* drivers/scsi/bnx2fc/bnx2fc_debug.h */
1177 printf_hook(ql_dbg
, 4, 5); /* drivers/scsi/qla2xxx/qla_dbg.h */
1178 printf_hook(ql_dbg_pci
, 4, 5); /* drivers/scsi/qla2xxx/qla_dbg.h */
1179 printf_hook(ql_log
, 4, 5); /* drivers/scsi/qla2xxx/qla_dbg.h */
1180 printf_hook(ql_log_pci
, 4, 5); /* drivers/scsi/qla2xxx/qla_dbg.h */
1181 printf_hook(libcfs_debug_msg
, 2, 3); /* drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h */
1182 printf_hook(libcfs_debug_vmsg2
, 4, 5); /* drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h */
1183 printf_hook(_ldlm_lock_debug
, 3, 4); /* drivers/staging/lustre/lustre/include/lustre_dlm.h */
1184 printf_hook(_debug_req
, 3, 4); /* drivers/staging/lustre/lustre/include/lustre_net.h */
1185 printf_hook(iscsi_change_param_sprintf
, 2, 3); /* drivers/target/iscsi/iscsi_target_login.c */
1186 printf_hook(dbg
, 1, 2); /* drivers/tty/serial/samsung.c */
1187 printf_hook(_usb_stor_dbg
, 2, 3); /* drivers/usb/storage/debug.h */
1188 printf_hook(usb_stor_dbg
, 2, 3); /* drivers/usb/storage/debug.h */
1189 printf_hook(vringh_bad
, 1, 2); /* drivers/vhost/vringh.c */
1190 printf_hook(__adfs_error
, 3, 4); /* fs/adfs/adfs.h */
1191 printf_hook(affs_error
, 3, 4); /* fs/affs/affs.h */
1192 printf_hook(affs_warning
, 3, 4); /* fs/affs/affs.h */
1193 printf_hook(befs_debug
, 2, 3); /* fs/befs/befs.h */
1194 printf_hook(befs_error
, 2, 3); /* fs/befs/befs.h */
1195 printf_hook(befs_warning
, 2, 3); /* fs/befs/befs.h */
1196 printf_hook(__btrfs_panic
, 5, 6); /* fs/btrfs/ctree.h */
1197 printf_hook(__btrfs_std_error
, 5, 6); /* fs/btrfs/ctree.h */
1198 printf_hook(btrfs_printk
, 2, 3); /* fs/btrfs/ctree.h */
1199 printf_hook(cifs_vfs_err
, 1, 2); /* fs/cifs/cifs_debug.h */
1200 printf_hook(__ecryptfs_printk
, 1, 2); /* fs/ecryptfs/ecryptfs_kernel.h */
1201 printf_hook(ext2_error
, 3, 4); /* fs/ext2/ext2.h */
1202 printf_hook(ext2_msg
, 3, 4); /* fs/ext2/ext2.h */
1203 printf_hook(ext3_abort
, 3, 4); /* fs/ext3/ext3.h */
1204 printf_hook(ext3_error
, 3, 4); /* fs/ext3/ext3.h */
1205 printf_hook(ext3_msg
, 3, 4); /* fs/ext3/ext3.h */
1206 printf_hook(ext3_warning
, 3, 4); /* fs/ext3/ext3.h */
1207 printf_hook(__ext4_abort
, 4, 5); /* fs/ext4/ext4.h */
1208 printf_hook(__ext4_error
, 4, 5); /* fs/ext4/ext4.h */
1209 printf_hook(__ext4_error_file
, 5, 6); /* fs/ext4/ext4.h */
1210 printf_hook(__ext4_error_inode
, 5, 6); /* fs/ext4/ext4.h */
1211 printf_hook(__ext4_grp_locked_error
, 7, 8); /* fs/ext4/ext4.h */
1212 printf_hook(__ext4_msg
, 3, 4); /* fs/ext4/ext4.h */
1213 printf_hook(__ext4_warning
, 4, 5); /* fs/ext4/ext4.h */
1214 printf_hook(f2fs_msg
, 3, 4); /* fs/f2fs/f2fs.h */
1215 printf_hook(__fat_fs_error
, 3, 4); /* fs/fat/fat.h */
1216 printf_hook(fat_msg
, 3, 4); /* fs/fat/fat.h */
1217 printf_hook(gfs2_print_dbg
, 2, 3); /* fs/gfs2/glock.h */
1218 printf_hook(gfs2_lm_withdraw
, 2, 3); /* fs/gfs2/util.h */
1219 printf_hook(hpfs_error
, 2, 3); /* fs/hpfs/hpfs_fn.h */
1220 printf_hook(jfs_error
, 2, 3); /* fs/jfs/jfs_superblock.h */
1221 printf_hook(nilfs_error
, 3, 4); /* fs/nilfs2/nilfs.h */
1222 printf_hook(nilfs_warning
, 3, 4); /* fs/nilfs2/nilfs.h */
1223 printf_hook(__ntfs_debug
, 4, 5); /* fs/ntfs/debug.h */
1224 printf_hook(__ntfs_error
, 3, 4); /* fs/ntfs/debug.h */
1225 printf_hook(__ntfs_warning
, 3, 4); /* fs/ntfs/debug.h */
1226 printf_hook(__ocfs2_abort
, 3, 4); /* fs/ocfs2/super.h */
1227 printf_hook(__ocfs2_error
, 3, 4); /* fs/ocfs2/super.h */
1228 printf_hook(_udf_err
, 3, 4); /* fs/udf/udfdecl.h */
1229 printf_hook(_udf_warn
, 3, 4); /* fs/udf/udfdecl.h */
1230 printf_hook(ufs_error
, 3, 4); /* fs/ufs/ufs.h */
1231 printf_hook(ufs_panic
, 3, 4); /* fs/ufs/ufs.h */
1232 printf_hook(ufs_warning
, 3, 4); /* fs/ufs/ufs.h */
1233 printf_hook(xfs_alert
, 2, 3); /* fs/xfs/xfs_message.h */
1234 printf_hook(xfs_alert_tag
, 3, 4); /* fs/xfs/xfs_message.h */
1235 printf_hook(xfs_crit
, 2, 3); /* fs/xfs/xfs_message.h */
1236 printf_hook(xfs_debug
, 2, 3); /* fs/xfs/xfs_message.h */
1237 printf_hook(xfs_emerg
, 2, 3); /* fs/xfs/xfs_message.h */
1238 printf_hook(xfs_err
, 2, 3); /* fs/xfs/xfs_message.h */
1239 printf_hook(xfs_info
, 2, 3); /* fs/xfs/xfs_message.h */
1240 printf_hook(xfs_notice
, 2, 3); /* fs/xfs/xfs_message.h */
1241 printf_hook(xfs_warn
, 2, 3); /* fs/xfs/xfs_message.h */
1242 printf_hook(warn_slowpath_fmt
, 3, 4); /* include/asm-generic/bug.h */
1243 printf_hook(warn_slowpath_fmt_taint
, 4, 5); /* include/asm-generic/bug.h */
1244 printf_hook(drm_err
, 1, 2); /* include/drm/drmP.h */
1245 printf_hook(drm_ut_debug_printk
, 2, 3); /* include/drm/drmP.h */
1246 printf_hook(__acpi_handle_debug
, 3, 4); /* include/linux/acpi.h */
1247 printf_hook(acpi_handle_printk
, 3, 4); /* include/linux/acpi.h */
1248 printf_hook(audit_log
, 4, 5); /* include/linux/audit.h */
1249 printf_hook(audit_log_format
, 2, 3); /* include/linux/audit.h */
1250 printf_hook(bdi_register
, 3, 4); /* include/linux/backing-dev.h */
1251 printf_hook(__trace_note_message
, 2, 3); /* include/linux/blktrace_api.h */
1252 printf_hook(_dev_info
, 2, 3); /* include/linux/device.h */
1253 printf_hook(dev_alert
, 2, 3); /* include/linux/device.h */
1254 printf_hook(dev_crit
, 2, 3); /* include/linux/device.h */
1255 printf_hook(dev_emerg
, 2, 3); /* include/linux/device.h */
1256 printf_hook(dev_err
, 2, 3); /* include/linux/device.h */
1257 printf_hook(dev_notice
, 2, 3); /* include/linux/device.h */
1258 printf_hook(dev_printk
, 3, 4); /* include/linux/device.h */
1259 printf_hook(dev_printk_emit
, 3, 4); /* include/linux/device.h */
1260 printf_hook(dev_set_name
, 2, 3); /* include/linux/device.h */
1261 printf_hook(dev_vprintk_emit
, 3, 0); /* include/linux/device.h */
1262 printf_hook(dev_warn
, 2, 3); /* include/linux/device.h */
1263 printf_hook(device_create
, 5, 6); /* include/linux/device.h */
1264 printf_hook(device_create_with_groups
, 6, 7); /* include/linux/device.h */
1265 printf_hook(devm_kasprintf
, 3, 4); /* include/linux/device.h */
1266 printf_hook(__dynamic_dev_dbg
, 3, 4); /* include/linux/dynamic_debug.h */
1267 printf_hook(__dynamic_netdev_dbg
, 3, 4); /* include/linux/dynamic_debug.h */
1268 printf_hook(__dynamic_pr_debug
, 2, 3); /* include/linux/dynamic_debug.h */
1269 printf_hook(__simple_attr_check_format
, 1, 2); /* include/linux/fs.h */
1270 printf_hook(fscache_init_cache
, 3, 4); /* include/linux/fscache-cache.h */
1271 printf_hook(gameport_set_phys
, 2, 3); /* include/linux/gameport.h */
1272 printf_hook(iio_trigger_alloc
, 1, 2); /* include/linux/iio/trigger.h */
1273 printf_hook(__check_printsym_format
, 1, 2); /* include/linux/kallsyms.h */
1274 printf_hook(kdb_printf
, 1, 2); /* include/linux/kdb.h */
1275 printf_hook(vkdb_printf
, 1, 0); /* include/linux/kdb.h */
1276 printf_hook(____trace_printk_check_format
, 1, 2); /* include/linux/kernel.h */
1277 printf_hook(__trace_bprintk
, 2, 3); /* include/linux/kernel.h */
1278 printf_hook(__trace_printk
, 2, 3); /* include/linux/kernel.h */
1279 printf_hook(kasprintf
, 2, 3); /* include/linux/kernel.h */
1280 printf_hook(panic
, 1, 2); /* include/linux/kernel.h */
1281 printf_hook(scnprintf
, 3, 4); /* include/linux/kernel.h */
1282 printf_hook(snprintf
, 3, 4); /* include/linux/kernel.h */
1283 printf_hook(sprintf
, 2, 3); /* include/linux/kernel.h */
1284 printf_hook(trace_printk
, 1, 2); /* include/linux/kernel.h */
1285 printf_hook(vscnprintf
, 3, 0); /* include/linux/kernel.h */
1286 printf_hook(vsnprintf
, 3, 0); /* include/linux/kernel.h */
1287 printf_hook(vsprintf
, 2, 0); /* include/linux/kernel.h */
1288 printf_hook(vmcoreinfo_append_str
, 1, 2); /* include/linux/kexec.h */
1289 printf_hook(__request_module
, 2, 3); /* include/linux/kmod.h */
1290 printf_hook(add_uevent_var
, 2, 3); /* include/linux/kobject.h */
1291 printf_hook(kobject_add
, 3, 4); /* include/linux/kobject.h */
1292 printf_hook(kobject_init_and_add
, 4, 5); /* include/linux/kobject.h */
1293 printf_hook(kobject_set_name
, 2, 3); /* include/linux/kobject.h */
1294 printf_hook(kthread_create_on_node
, 4, 5); /* include/linux/kthread.h */
1295 printf_hook(__ata_ehi_push_desc
, 2, 3); /* include/linux/libata.h */
1296 printf_hook(ata_dev_printk
, 3, 4); /* include/linux/libata.h */
1297 printf_hook(ata_ehi_push_desc
, 2, 3); /* include/linux/libata.h */
1298 printf_hook(ata_link_printk
, 3, 4); /* include/linux/libata.h */
1299 printf_hook(ata_port_desc
, 2, 3); /* include/linux/libata.h */
1300 printf_hook(ata_port_printk
, 3, 4); /* include/linux/libata.h */
1301 printf_hook(warn_alloc_failed
, 3, 4); /* include/linux/mm.h */
1302 printf_hook(mmiotrace_printk
, 1, 2); /* include/linux/mmiotrace.h */
1303 printf_hook(netdev_alert
, 2, 3); /* include/linux/netdevice.h */
1304 printf_hook(netdev_crit
, 2, 3); /* include/linux/netdevice.h */
1305 printf_hook(netdev_emerg
, 2, 3); /* include/linux/netdevice.h */
1306 printf_hook(netdev_err
, 2, 3); /* include/linux/netdevice.h */
1307 printf_hook(netdev_info
, 2, 3); /* include/linux/netdevice.h */
1308 printf_hook(netdev_notice
, 2, 3); /* include/linux/netdevice.h */
1309 printf_hook(netdev_printk
, 3, 4); /* include/linux/netdevice.h */
1310 printf_hook(netdev_warn
, 2, 3); /* include/linux/netdevice.h */
1311 printf_hook(early_printk
, 1, 2); /* include/linux/printk.h */
1312 printf_hook(no_printk
, 1, 2); /* include/linux/printk.h */
1313 printf_hook(printk
, 1, 2); /* include/linux/printk.h */
1314 printf_hook(printk_deferred
, 1, 2); /* include/linux/printk.h */
1315 printf_hook(printk_emit
, 5, 6); /* include/linux/printk.h */
1316 printf_hook(vprintk
, 1, 0); /* include/linux/printk.h */
1317 printf_hook(vprintk_emit
, 5, 0); /* include/linux/printk.h */
1318 printf_hook(__quota_error
, 3, 4); /* include/linux/quotaops.h */
1319 printf_hook(seq_buf_printf
, 2, 3); /* include/linux/seq_buf.h */
1320 printf_hook(seq_buf_vprintf
, 2, 0); /* include/linux/seq_buf.h */
1321 printf_hook(seq_printf
, 2, 3); /* include/linux/seq_file.h */
1322 printf_hook(seq_vprintf
, 2, 0); /* include/linux/seq_file.h */
1323 printf_hook(bprintf
, 3, 4); /* include/linux/string.h */
1324 printf_hook(trace_seq_printf
, 2, 3); /* include/linux/trace_seq.h */
1325 printf_hook(trace_seq_vprintf
, 2, 0); /* include/linux/trace_seq.h */
1326 printf_hook(__alloc_workqueue_key
, 1, 6); /* include/linux/workqueue.h */
1327 printf_hook(set_worker_desc
, 1, 2); /* include/linux/workqueue.h */
1328 printf_hook(_p9_debug
, 3, 4); /* include/net/9p/9p.h */
1329 printf_hook(bt_err
, 1, 2); /* include/net/bluetooth/bluetooth.h */
1330 printf_hook(bt_info
, 1, 2); /* include/net/bluetooth/bluetooth.h */
1331 printf_hook(nf_ct_helper_log
, 3, 4); /* include/net/netfilter/nf_conntrack_helper.h */
1332 printf_hook(nf_log_buf_add
, 2, 3); /* include/net/netfilter/nf_log.h */
1333 printf_hook(nf_log_packet
, 8, 9); /* include/net/netfilter/nf_log.h */
1334 printf_hook(SOCK_DEBUG
, 2, 3); /* include/net/sock.h */
1335 printf_hook(__snd_printk
, 4, 5); /* include/sound/core.h */
1336 printf_hook(_snd_printd
, 2, 3); /* include/sound/core.h */
1337 printf_hook(snd_printd
, 1, 2); /* include/sound/core.h */
1338 printf_hook(snd_printdd
, 1, 2); /* include/sound/core.h */
1339 printf_hook(snd_iprintf
, 2, 3); /* include/sound/info.h */
1340 printf_hook(snd_seq_create_kernel_client
, 3, 4); /* include/sound/seq_kernel.h */
1341 printf_hook(xen_raw_printk
, 1, 2); /* include/xen/hvc-console.h */
1342 printf_hook(xenbus_dev_error
, 3, 4); /* include/xen/xenbus.h */
1343 printf_hook(xenbus_dev_fatal
, 3, 4); /* include/xen/xenbus.h */
1344 printf_hook(xenbus_printf
, 4, 5); /* include/xen/xenbus.h */
1345 printf_hook(xenbus_watch_pathfmt
, 4, 5); /* include/xen/xenbus.h */
1346 printf_hook(batadv_fdebug_log
, 2, 3); /* net/batman-adv/debugfs.c */
1347 printf_hook(_batadv_dbg
, 4, 5); /* net/batman-adv/main.h */
1348 printf_hook(batadv_debug_log
, 2, 3); /* net/batman-adv/main.h */
1349 printf_hook(__sdata_dbg
, 2, 3); /* net/mac80211/debug.h */
1350 printf_hook(__sdata_err
, 1, 2); /* net/mac80211/debug.h */
1351 printf_hook(__sdata_info
, 1, 2); /* net/mac80211/debug.h */
1352 printf_hook(__wiphy_dbg
, 3, 4); /* net/mac80211/debug.h */
1353 printf_hook(mac80211_format_buffer
, 4, 5); /* net/mac80211/debugfs.h */
1354 printf_hook(__rds_conn_error
, 2, 3); /* net/rds/rds.h */
1355 printf_hook(rdsdebug
, 1, 2); /* net/rds/rds.h */
1356 printf_hook(printl
, 1, 2); /* net/sctp/probe.c */
1357 printf_hook(svc_printk
, 2, 3); /* net/sunrpc/svc.c */
1358 printf_hook(tomoyo_io_printf
, 2, 3); /* security/tomoyo/common.c */
1359 printf_hook(tomoyo_supervisor
, 2, 3); /* security/tomoyo/common.h */
1360 printf_hook(tomoyo_write_log
, 2, 3); /* security/tomoyo/common.h */
1361 printf_hook(cmp_error
, 2, 3); /* sound/firewire/cmp.c */