summaryrefslogtreecommitdiffstats
path: root/scripts/leaking_addresses.pl
diff options
context:
space:
mode:
authorTobin C. Harding <me@tobin.cc>2018-01-28 22:33:49 -0500
committerTobin C. Harding <me@tobin.cc>2018-04-06 18:50:34 -0400
commit5eb0da0568a241f72732eb2143538fb14879a52c (patch)
tree720254a6a378c39737ada94f27eec7c49cd7c6b7 /scripts/leaking_addresses.pl
parent6efb7458280a8f5d4c1955324e9d8985e90a882b (diff)
leaking_addresses: add is_arch() wrapper subroutine
Currently there is duplicate code when checking the architecture type. We can remove the duplication by implementing a wrapper function is_arch(). Implement and use wrapper function is_arch(). Signed-off-by: Tobin C. Harding <me@tobin.cc>
Diffstat (limited to 'scripts/leaking_addresses.pl')
-rwxr-xr-xscripts/leaking_addresses.pl26
1 files changed, 14 insertions, 12 deletions
diff --git a/scripts/leaking_addresses.pl b/scripts/leaking_addresses.pl
index 56894daf6368..e5b418cca185 100755
--- a/scripts/leaking_addresses.pl
+++ b/scripts/leaking_addresses.pl
@@ -170,24 +170,26 @@ sub is_supported_architecture
170 return (is_x86_64() or is_ppc64()); 170 return (is_x86_64() or is_ppc64());
171} 171}
172 172
173sub is_x86_64 173sub is_arch
174{ 174{
175 my $archname = `uname -m`; 175 my ($desc) = @_;
176 my $arch = `uname -m`;
177
178 chomp $arch;
179 if ($arch eq $desc) {
180 return 1;
181 }
182 return 0;
183}
176 184
177 if ($archname =~ m/x86_64/) { 185sub is_x86_64
178 return 1; 186{
179 } 187 return is_arch('x86_64');
180 return 0;
181} 188}
182 189
183sub is_ppc64 190sub is_ppc64
184{ 191{
185 my $archname = `uname -m`; 192 return is_arch('ppc64');
186
187 if ($archname =~ m/ppc64/) {
188 return 1;
189 }
190 return 0;
191} 193}
192 194
193# Gets config option value from kernel config file. 195# Gets config option value from kernel config file.