From 86af1d6707956fa401399d16b10eeab5f24976ce Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 27 Oct 2022 23:57:51 -0700 Subject: [PATCH] e2ap: fix a compiler warning due to a strange maxofRICrequestID value. The minimum and maximum length arguments to dissect_per_constrained_set_of() are currently both ints. According to O-RAN.WG3.E2AP-v02.03, section 9.3.7 "Constant definitions", maxofRICrequestID is 1024, not 2^32-1; however, we were specifying it as 2^32-1 (4294967295). 2^32-1 won't fit into an int, and Apple clang version 14.0.0 (clang-1400.0.29.102) warns about that: ./asn1/e2ap/e2ap.cnf:647:54: error: implicit conversion from 'long' to 'int' changes value from 4294967295 to -1 [-Werror,-Wconstant-conversion] 1, maxofRICrequestID, FALSE); ^~~~~~~~~~~~~~~~~ ./asn1/e2ap/packet-e2ap-val.h:7:40: note: expanded from macro 'maxofRICrequestID' #define maxofRICrequestID 4294967295 ^~~~~~~~~~ The handling of MIN and MAX should be done with separate "minimum is MIN" and "maximum is MAX" flags, and we might want either to have asn2wrs.py reject attempts to have constraints with integer minimum and maximum values outside the range [-2^31, 2^31-1], make the types for sizes unsigned, or allow 64-bit constraints (and still limit the constraint values, so we don't have to dive down a bignum rathole). But, for now, we just change maxofRICrequestID to match what the 2022-10 version of the spec, 2.03, appears to say. (I can't find the 2.01 version online, so I don't know whether it was 1024 in 2.01, or if it was changed in 2.02 or 2.03.) --- epan/dissectors/asn1/e2ap/E2AP-Constants.asn | 2 +- epan/dissectors/packet-e2ap.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epan/dissectors/asn1/e2ap/E2AP-Constants.asn b/epan/dissectors/asn1/e2ap/E2AP-Constants.asn index dec0bcc100..3146e97998 100644 --- a/epan/dissectors/asn1/e2ap/E2AP-Constants.asn +++ b/epan/dissectors/asn1/e2ap/E2AP-Constants.asn @@ -55,7 +55,7 @@ maxofE2nodeComponents INTEGER ::= 1024 maxofRANfunctionID INTEGER ::= 256 maxofRICactionID INTEGER ::= 16 maxofTNLA INTEGER ::= 32 -maxofRICrequestID INTEGER ::= 4294967295 +maxofRICrequestID INTEGER ::= 1024 -- ************************************************************** diff --git a/epan/dissectors/packet-e2ap.c b/epan/dissectors/packet-e2ap.c index f950cd9146..b78aa9b52a 100644 --- a/epan/dissectors/packet-e2ap.c +++ b/epan/dissectors/packet-e2ap.c @@ -56,7 +56,7 @@ static dissector_handle_t e2ap_handle; #define maxofRANfunctionID 256 #define maxofRICactionID 16 #define maxofTNLA 32 -#define maxofRICrequestID 4294967295 +#define maxofRICrequestID 1024 #define maxE1APid 65535 #define maxF1APid 4 #define maxEARFCN 65535