From 5d97b658d9c2ec0cd68e5632ce7f11bfe5d6c282 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Fri, 8 Mar 2024 15:32:50 +0100 Subject: tools/syz-linter: check all Logf calls We have a variety of T.Logf() methods, while in most cases there's no need to add signatures of each individual method to the syz-linter. Co-authored-by: Dmitry Vyukov --- tools/syz-linter/linter.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/syz-linter/linter.go b/tools/syz-linter/linter.go index d0cd0879b..76168c7c9 100644 --- a/tools/syz-linter/linter.go +++ b/tools/syz-linter/linter.go @@ -252,7 +252,7 @@ func (pass *Pass) checkFlagDefinition(n *ast.CallExpr) { // checkLogErrorFormat warns about log/error messages starting with capital letter or ending with a period. func (pass *Pass) checkLogErrorFormat(n *ast.CallExpr) { arg, newLine, sure := pass.logFormatArg(n) - if arg == -1 { + if arg == -1 || len(n.Args) <= arg { return } val, ok := stringLit(n.Args[arg]) @@ -302,6 +302,9 @@ func (pass *Pass) logFormatArg(n *ast.CallExpr) (arg int, newLine, sure bool) { } return 1, true, true } + if fun.Sel.String() == "Logf" { + return 1, false, true + } return -1, false, false } -- cgit mrf-deployment