swtpm: Fix a comparison of different signedness
Fix the following compilation issue:
CC libswtpm_libtpms_la-swtpm_nvstore_linear_file.lo
swtpm_nvstore_linear_file.c: In function 'SWTPM_NVRAM_LinearFile_Flush':
swtpm_nvstore_linear_file.c:238:28: error: comparison of integer expressions of different signedness: 'long int' and 'unsigned int' [-Werror=sign-compare]
| } else if (n == 0 || n > UINT32_MAX) {
Resolves: Issue #1169
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
diff --git a/src/swtpm/swtpm_nvstore_linear_file.c b/src/swtpm/swtpm_nvstore_linear_file.c
index be19ced..6380767 100644
--- a/src/swtpm/swtpm_nvstore_linear_file.c
+++ b/src/swtpm/swtpm_nvstore_linear_file.c
@@ -235,7 +235,7 @@
logprintf(STDERR_FILENO, "%s: sysconf failed: %s\n",
__func__, strerror(errno));
return TPM_FAIL;
- } else if (n == 0 || n > UINT32_MAX) {
+ } else if (n == 0 || (unsigned long)n > UINT32_MAX) {
logprintf(STDERR_FILENO, "%s: sysconf returned bad value for _SC_PAGESIZE: %ld\n",
__func__, n);
return TPM_FAIL;