2013-11-21 14:23:30

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 1/2] android/ipc: Zero initialize cmsg buffer

From: Andrei Emeltchenko <[email protected]>

This fixes valgrind warnings:
...
Syscall param sendmsg(msg.msg_control) points to uninitialised byte(s)
...
---
android/ipc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/android/ipc.c b/android/ipc.c
index 2fa90bd..4044d4d 100644
--- a/android/ipc.c
+++ b/android/ipc.c
@@ -47,6 +47,7 @@ void ipc_send(int sk, uint8_t service_id, uint8_t opcode, uint16_t len,

memset(&msg, 0, sizeof(msg));
memset(&m, 0, sizeof(m));
+ memset(cmsgbuf, 0, sizeof(cmsgbuf));

m.service_id = service_id;
m.opcode = opcode;
--
1.8.3.2



2013-11-21 14:44:13

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH 1/2] android/ipc: Zero initialize cmsg buffer

Hi Andrei,

On Thu, Nov 21, 2013, Andrei Emeltchenko wrote:
> This fixes valgrind warnings:
> ...
> Syscall param sendmsg(msg.msg_control) points to uninitialised byte(s)
> ...
> ---
> android/ipc.c | 1 +
> 1 file changed, 1 insertion(+)

Both patches have been applied. Thanks.

Johan

2013-11-21 14:23:31

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 2/2] android/haltest: Zero initialize cmsg buffer

From: Andrei Emeltchenko <[email protected]>

---
android/client/if-sock.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/android/client/if-sock.c b/android/client/if-sock.c
index 2cd06e8..eef9a76 100644
--- a/android/client/if-sock.c
+++ b/android/client/if-sock.c
@@ -130,6 +130,7 @@ static void read_accepted(int fd)

memset(&msg, 0, sizeof(msg));
memset(&iv, 0, sizeof(iv));
+ memset(cmsgbuf, 0, sizeof(cmsgbuf));

iv.iov_base = &cs;
iv.iov_len = sizeof(cs);
--
1.8.3.2