Hi,
I couldn't do any real device testing because I don't have any storage
space to build replicant 6 and would have had to delete replicant 11
work to do this so if this patch looks good to you it would be awesome
if you could give it a spin on a real device.
Joonas
Joonas Kylmälä:
> When compiling with warnings (-Werror -W -Wall -Wunused
> -Wunused-function) enabled we get:
>
> rfs.c: In function ‘ipc_nv_data_md5_path_check’:
> rfs.c:115:17: error: comparison of integer expressions of different
> signedness: ‘__off_t’ {aka ‘long int’} and ‘long unsigned int’
> [-Werror=sign-compare]
> if (st.st_size < 2 * sizeof(char) * MD5_DIGEST_LENGTH) {
> ^
> This simplifies the comparison by making sure we have exactly 32
> bytes (2*MD5_DIGEST_LENGTH, i.e. md5 digest in ascii) in the file we
> read the MD5 digest from.
>
> Signed-off-by: Joonas Kylmälä <[email protected]>
> ---
> samsung-ipc/rfs.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/samsung-ipc/rfs.c b/samsung-ipc/rfs.c
> index 114df99..93d2b6e 100644
> --- a/samsung-ipc/rfs.c
> +++ b/samsung-ipc/rfs.c
> @@ -32,6 +32,8 @@
>
> #include "ipc.h"
>
> +#define MD5_DIGEST_LENGTH_ASCII (2 * MD5_DIGEST_LENGTH)
> +
> char *ipc_nv_data_md5_calculate(struct ipc_client *client,
> const char *path, const char *secret,
> size_t size, size_t chunk_size)
> @@ -112,7 +114,7 @@ int ipc_nv_data_md5_path_check(struct ipc_client *client)
> return -1;
> }
>
> - if (st.st_size < 2 * sizeof(char) * MD5_DIGEST_LENGTH) {
> + if (st.st_size != MD5_DIGEST_LENGTH_ASCII) {
> ipc_client_log(client, "Checking nv_data md5 size failed");
> return -1;
> }
> @@ -173,7 +175,7 @@ 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 (st.st_size != MD5_DIGEST_LENGTH_ASCII) {
> ipc_client_log(client,
> "Checking nv_data backup md5 size failed");
> return -1;
> @@ -493,7 +495,7 @@ int ipc_nv_data_restore(struct ipc_client *client)
> free(data);
> data = NULL;
>
> - length = 2 * sizeof(char) * MD5_DIGEST_LENGTH;
> + length = MD5_DIGEST_LENGTH_ASCII;
>
> data = file_data_read(client, backup_md5_path, length, length, 0);
> if (data == NULL) {
>
_______________________________________________
Replicant mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/replicant