Without that fix, when building libsamsung-ipc under GNU/Linux
with the "-Werror -W -Wall -Wunused -Wunused-function" CFLAGS,
GCC and the autotools build system, we have:
samsung-ipc/rfs.c:115:17: error: comparison of integers
of different signs:
'__off_t' (aka 'long') and 'unsigned int' [-Werror,-Wsign-compare]
if (st.st_size < 2 * sizeof(char) * MD5_DIGEST_LENGTH) {
~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
samsung-ipc/rfs.c:176:17: error: comparison of integers
of different signs:
'__off_t' (aka 'long') and 'unsigned int' [-Werror,-Wsign-compare]
if (st.st_size < 2 * sizeof(char) * MD5_DIGEST_LENGTH) {
~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
samsung-ipc/rfs.c:115:17: error: comparison of integers
of different signs:
'__off_t' (aka 'long') and 'unsigned int' [-Werror,-Wsign-compare]
if (st.st_size < 2 * sizeof(char) * MD5_DIGEST_LENGTH) {
~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
samsung-ipc/rfs.c:176:17: error: comparison of integers
of different signs:
'__off_t' (aka 'long') and 'unsigned int' [-Werror,-Wsign-compare]
if (st.st_size < 2 * sizeof(char) * MD5_DIGEST_LENGTH) {
~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Denis 'GNUtoo' Carikli <[email protected]>
---
samsung-ipc/rfs.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/samsung-ipc/rfs.c b/samsung-ipc/rfs.c
index 114df99..3871b35 100644
--- a/samsung-ipc/rfs.c
+++ b/samsung-ipc/rfs.c
@@ -112,7 +112,8 @@ int ipc_nv_data_md5_path_check(struct ipc_client *client)
return -1;
}
- if (st.st_size < 2 * sizeof(char) * MD5_DIGEST_LENGTH) {
+ if ((unsigned long)st.st_size <
+ (2 * (unsigned long)sizeof(char) * MD5_DIGEST_LENGTH)) {
ipc_client_log(client, "Checking nv_data md5 size failed");
return -1;
}
@@ -173,7 +174,8 @@ int ipc_nv_data_backup_md5_path_check(struct ipc_client
*client)
return -1;
}
- if (st.st_size < 2 * sizeof(char) * MD5_DIGEST_LENGTH) {
+ if ((unsigned long)st.st_size <
+ (2 * (unsigned long)sizeof(char) * MD5_DIGEST_LENGTH)) {
ipc_client_log(client,
"Checking nv_data backup md5 size failed");
return -1;
--
2.29.2
_______________________________________________
Replicant mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/replicant