@@ -400,6 +400,20 @@ static bool process_string(const char *fmt, int len, struct trace_event_call *ca
400
400
return true;
401
401
}
402
402
403
+ static void handle_dereference_arg (const char * arg_str , u64 string_flags , int len ,
404
+ u64 * dereference_flags , int arg ,
405
+ struct trace_event_call * call )
406
+ {
407
+ if (string_flags & (1ULL << arg )) {
408
+ if (process_string (arg_str , len , call ))
409
+ * dereference_flags &= ~(1ULL << arg );
410
+ } else if (process_pointer (arg_str , len , call ))
411
+ * dereference_flags &= ~(1ULL << arg );
412
+ else
413
+ pr_warn ("TRACE EVENT ERROR: Bad dereference argument: '%.*s'\n" ,
414
+ len , arg_str );
415
+ }
416
+
403
417
/*
404
418
* Examine the print fmt of the event looking for unsafe dereference
405
419
* pointers using %p* that could be recorded in the trace event and
@@ -563,11 +577,9 @@ static void test_event_printk(struct trace_event_call *call)
563
577
}
564
578
565
579
if (dereference_flags & (1ULL << arg )) {
566
- if (string_flags & (1ULL << arg )) {
567
- if (process_string (fmt + start_arg , e - start_arg , call ))
568
- dereference_flags &= ~(1ULL << arg );
569
- } else if (process_pointer (fmt + start_arg , e - start_arg , call ))
570
- dereference_flags &= ~(1ULL << arg );
580
+ handle_dereference_arg (fmt + start_arg , string_flags ,
581
+ e - start_arg ,
582
+ & dereference_flags , arg , call );
571
583
}
572
584
573
585
start_arg = i ;
@@ -578,11 +590,9 @@ static void test_event_printk(struct trace_event_call *call)
578
590
}
579
591
580
592
if (dereference_flags & (1ULL << arg )) {
581
- if (string_flags & (1ULL << arg )) {
582
- if (process_string (fmt + start_arg , i - start_arg , call ))
583
- dereference_flags &= ~(1ULL << arg );
584
- } else if (process_pointer (fmt + start_arg , i - start_arg , call ))
585
- dereference_flags &= ~(1ULL << arg );
593
+ handle_dereference_arg (fmt + start_arg , string_flags ,
594
+ i - start_arg ,
595
+ & dereference_flags , arg , call );
586
596
}
587
597
588
598
/*
0 commit comments