Remove tautological comparison.
Also build with -Wtype-limits to catch future instances.
Bug: 529
Change-Id: I2d84dc1824ffc7cd92411f49c9f953bcd3c74331
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/55045
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 69169c4..780ed21 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -132,7 +132,7 @@
if(CMAKE_COMPILER_IS_GNUCXX OR CLANG)
# Note clang-cl is odd and sets both CLANG and MSVC. We base our configuration
# primarily on our normal Clang one.
- set(C_CXX_FLAGS "-Werror -Wformat=2 -Wsign-compare -Wmissing-field-initializers -Wwrite-strings -Wvla -Wshadow")
+ set(C_CXX_FLAGS "-Werror -Wformat=2 -Wsign-compare -Wmissing-field-initializers -Wwrite-strings -Wvla -Wshadow -Wtype-limits")
if(MSVC)
# clang-cl sets different default warnings than clang. It also treats -Wall
# as -Weverything, to match MSVC. Instead -W3 is the alias for -Wall.
diff --git a/crypto/trust_token/trust_token.c b/crypto/trust_token/trust_token.c
index ccfecdb..55785d5 100644
--- a/crypto/trust_token/trust_token.c
+++ b/crypto/trust_token/trust_token.c
@@ -626,11 +626,7 @@
return CBB_add_u8(cbb, 0x1a | major_type) &&
CBB_add_u32(cbb, (uint32_t)value);
}
- if (value <= 0xffffffffffffffff) {
- return CBB_add_u8(cbb, 0x1b | major_type) && CBB_add_u64(cbb, value);
- }
-
- return 0;
+ return CBB_add_u8(cbb, 0x1b | major_type) && CBB_add_u64(cbb, value);
}
// https://tools.ietf.org/html/rfc7049#section-2.1