[Replicant] [libsamsung-ipc][PATCH 04/10] tools: nv_data-imei: get rid of "pointer of type 'void *' used in subtraction"

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Sat Feb 13 13:17:43 UTC 2021


When building nv_data-imei in Replicant 6 we have:
  hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:
  In function 'bruteforce_imei_offset':
  hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:675:18:
  warning: pointer of type 'void *' used in subtraction [-Wpointer-arith]
               (ptr - buffer),
                    ^
Using a data type with a known size like char* avoids this error.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
---
 tools/nv_data-imei.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/nv_data-imei.c b/tools/nv_data-imei.c
index 97ed66a..5ba2a05 100644
--- a/tools/nv_data-imei.c
+++ b/tools/nv_data-imei.c
@@ -619,8 +619,8 @@ int bruteforce_imei_offset(char *nv_data_path, struct imei *given_imei)
 	size_t file_size;
 	size_t search_size;
 	size_t nv_data_chunk_size;
-	void *buffer = NULL;
-	void *ptr = NULL;
+	char *buffer = NULL;
+	char *ptr = NULL;
 	unsigned char given_imei_buffer[(IMEI_LENGTH + 1) / 2] = { 0 };
 	bool found_imei = false;
 	int rc;
@@ -706,7 +706,7 @@ int read_imei(char *nv_data_path, struct offset *offset)
 	struct imei imei;
 	size_t file_size;
 	size_t nv_data_chunk_size;
-	void *buffer = NULL;
+	unsigned char *buffer = NULL;
 	int rc;
 
 	memset(&imei, 0, sizeof(imei));
-- 
2.30.1



More information about the Replicant mailing list