History

leaking_addresses: Always print a trailing newline

For files that lack trailing newlines and match a leaking address (e.g. wchan[1]), the leaking_addresses.pl report would run together with the next line, making things look corrupted. Unconditionally remove the newline on input, and write it back out on output. [1] https://lore.kernel.org/all/20210103142726.GC30643@xsang-OptiPlex-9020/

Kees Cook committed 5 years ago

Commit cf2a85e1 parent 54354c61 file · +2 −1Browse files

Unified · Split

scripts/leaking_addresses.pl+2−1
@@ -455,8 +455,9 @@ sub parse_file · 454 unmodified lines
455 455
456 open my $fh, "<", $file or return;456 open my $fh, "<", $file or return;
457 while ( <$fh> ) {457 while ( <$fh> ) {
458 chomp;
458 if (may_leak_address($_)) {459 if (may_leak_address($_)) {
459 print $file . ': ' . $_;460 printf("$file: $_\n");
460 }461 }
461 }462 }
462 close $fh;463 close $fh;