Skip to content

Commit

Permalink
Fix perl issue with secureboot range checking on ubuntu systems
Browse files Browse the repository at this point in the history
The array indexing syntax used in the secureboot range checking code
is not very portable. I updated the syntax to use a more widely
accepted style.

Change-Id: Id4c39ceceac1fb7fcae27ed90234c37532efd7be
RTC:163084
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/43403
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
popfuture authored and dcrowell77 committed Jul 21, 2017
1 parent 2db3963 commit f53897a
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/usr/targeting/common/xmltohb/xmltohb.pl
Expand Up @@ -857,45 +857,45 @@ sub validateRangeMinsAndMaxes {
my $i=0;
# if the first range is an unbounded max then it stands alone
my $prevMax = "-inf"; # default prevMax is negative infinity
if (!exists @rangeArray->[$i]->{min})
if (!exists $rangeArray[$i]->{min})
{
if (!exists @rangeArray->[$i]->{max})
if (!exists $rangeArray[$i]->{max})
{
die "$attr_id has range tag with no min or max!";
}
$prevMax = @rangeArray->[$i]->{max};
$prevMax = $rangeArray[$i]->{max};
$i++;
}

# go through the list and check for undesired overlap of ranges
while (exists @rangeArray->[$i]->{min} && exists @rangeArray->[$i]->{max})
while (exists $rangeArray[$i]->{min} && exists $rangeArray[$i]->{max})
{
if (@rangeArray->[$i]->{max} < @rangeArray->[$i]->{min})
if ($rangeArray[$i]->{max} < $rangeArray[$i]->{min})
{
print Dumper(@rangeArray[$i]);
print Dumper($rangeArray[$i]);
die "Min/max pair in <range> tag inverted!";
}
if ($prevMax > @rangeArray->[$i]->{min})
if ($prevMax > $rangeArray[$i]->{min})
{
print "Previous max: $prevMax\n";
print Dumper(@rangeArray[$i]);
print Dumper($rangeArray[$i]);
die "Range overlap! Previous <max> tag $prevMax "
. "exceeds <min> tag value! @rangeArray->[$i]->{min}";
. "exceeds <min> tag value! $rangeArray[$i]->{min}";
}
$prevMax = @rangeArray->[$i]->{max};
$prevMax = $rangeArray[$i]->{max};
$i++;
}

# check for stray min tag at the end
if (exists @rangeArray->[$i]->{min})
if (exists $rangeArray[$i]->{min})
{
# make sure trailing min is greater than previous max
if ($prevMax > @rangeArray->[$i]->{min})
if ($prevMax > $rangeArray[$i]->{min})
{
print "Previous max: $prevMax\n";
print Dumper(@rangeArray[$i]);
print Dumper($rangeArray[$i]);
die "Range overlap! Previous <max> tag $prevMax "
. "exceeds <min> tag value! @rangeArray->[$i]->{min}";
. "exceeds <min> tag value! $rangeArray[$i]->{min}";
}
}

Expand Down

0 comments on commit f53897a

Please sign in to comment.