Skip to content

Commit

Permalink
leaking_addresses: check if file name contains address
Browse files Browse the repository at this point in the history
Sometimes files may be created by using output from printk.  As the scan
traverses the directory tree we should parse each path name and check if
it is leaking an address.

Add check for leaking address on each path name.

Suggested-by: Tycho Andersen <[email protected]>
Acked-by: Tycho Andersen <[email protected]>
Signed-off-by: Tobin C. Harding <[email protected]>
  • Loading branch information
tcharding committed Apr 6, 2018
1 parent 2306a67 commit c73dff5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/leaking_addresses.pl
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,16 @@ sub parse_file
close $fh;
}

# Checks if the actual path name is leaking a kernel address.
sub check_path_for_leaks
{
my ($path) = @_;

if (may_leak_address($path)) {
printf("Path name may contain address: $path\n");
}
}

# Recursively walk directory tree.
sub walk
{
Expand All @@ -485,6 +495,8 @@ sub walk

next if (skip($path));

check_path_for_leaks($path);

if (-d $path) {
push @dirs, $path;
next;
Expand Down

0 comments on commit c73dff5

Please sign in to comment.