[CRIU] [PATCH 4/4] unix: fix calculation of pointers

Andrey Vagin avagin at openvz.org
Fri Dec 20 13:13:33 PST 2013


CID 1141016 (#1 of 1): Extra sizeof expression (SIZEOF_MISMATCH)
suspicious_pointer_arithmetic: Adding "40UL /* sizeof (FilePermsEntry)
*/" to pointer "(FownEntry *)perms" of type "FownEntry *" is suspicious
because adding an integral value to this pointer automatically scales
that value by the size, 48 bytes, of the pointed-to type, "FownEntry".
Most likely, "sizeof (FilePermsEntry)" is extraneous and should be
replaced with 1.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 sk-unix.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sk-unix.c b/sk-unix.c
index 1f80e2f..4a1fe48 100644
--- a/sk-unix.c
+++ b/sk-unix.c
@@ -158,9 +158,9 @@ static int dump_one_unix_fd(int lfd, u32 id, const struct fd_parms *p)
 	if (ue == NULL)
 		return -1;
 
-	skopts = (SkOptsEntry *) ue + sizeof(UnixSkEntry);
-	perms = (FilePermsEntry *) skopts + sizeof(SkOptsEntry);
-	fown = (FownEntry *) perms + sizeof(FilePermsEntry);
+	skopts = (void *) ue + sizeof(UnixSkEntry);
+	perms = (void *) skopts + sizeof(SkOptsEntry);
+	fown = (void *) perms + sizeof(FilePermsEntry);
 
 	unix_sk_entry__init(ue);
 	sk_opts_entry__init(skopts);
-- 
1.8.3.1



More information about the CRIU mailing list