Subrata Banik has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/84575?usp=email )
Change subject: util/lint: Use bigint for hexadecimal values in handle_range ......................................................................
util/lint: Use bigint for hexadecimal values in handle_range
The `handle_range` function in `kconfig_lint` was failing to correctly handle large hexadecimal values ( 64-bit value) due to limitations with Perl's handling of standard integers.
This commit modifies the function to use the `bigint` pragma, enabling it to handle arbitrarily large integers. This prevents issues with 64-bit hexadecimal values and ensures accurate comparisons for range validation.
Change-Id: I402bb9bec9ba5bfb79b4185f35228c41d4a7b674 Signed-off-by: Subrata Banik subratabanik@google.com --- M util/lint/kconfig_lint 1 file changed, 5 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/75/84575/1
diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint index 43b1630..b051dd9 100755 --- a/util/lint/kconfig_lint +++ b/util/lint/kconfig_lint @@ -856,12 +856,14 @@ my $expression; ( $range2, $expression ) = handle_if_line( $range2, $inside_config, $filename, $line_no );
+ # Use bigint for large hexadecimal values + use bigint; $range1 =~ /^\s*(?:0x)?([A-Fa-f0-9]+)\s*$/; - my $checkrange1 = $1; + my $checkrange1 = Math::BigInt->new($1); $range2 =~ /^\s*(?:0x)?([A-Fa-f0-9]+)\s*$/; - my $checkrange2 = $1; + my $checkrange2 = Math::BigInt->new($1);
- if ( $checkrange1 && $checkrange2 && ( hex($checkrange1) > hex($checkrange2) ) ) { + if ( $checkrange1 && $checkrange2 && ( $checkrange1 > $checkrange2 ) ) { show_error("Range entry in $filename line $line_no value 1 ($range1) is greater than value 2 ($range2)."); }