All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] genl: Initialize used memory to avoid valgrind report
@ 2015-01-30 10:11 Jukka Rissanen
  2015-02-02 15:32 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Jukka Rissanen @ 2015-01-30 10:11 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 1372 bytes --]

Valgrind reports following error for uninitialized memory usage:

 ==4725== Syscall param socketcall.sendto(msg) points to uninitialised byte(s)
 ==4725==    at 0x33F5EF6B5D: send (in /usr/lib64/libc-2.17.so)
 ==4725==    by 0x40BF0E: can_write_data (genl.c:314)
 ==4725==    by 0x417806: io_callback (io.c:138)
 ==4725==    by 0x40A282: l_main_run (main.c:346)
 ==4725==    by 0x401F69: main (main.c:160)
 ==4725==  Address 0x4c3d092 is 18 bytes inside a block of size 40 alloc'd
 ==4725==    at 0x4A06409: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
 ==4725==    by 0x40817D: l_malloc (util.c:62)
 ==4725==    by 0x40C46A: msg_alloc.constprop.13 (genl.c:243)
 ==4725==    by 0x40D454: l_genl_family_new (genl.c:641)
 ==4725==    by 0x405A44: wiphy_init (wiphy.c:1492)
 ==4725==    by 0x401EDD: main (main.c:154)
 ==4725==
---
 ell/genl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ell/genl.c b/ell/genl.c
index d2c1784..2ef6a34 100644
--- a/ell/genl.c
+++ b/ell/genl.c
@@ -239,7 +239,7 @@ static struct l_genl_msg *msg_alloc(uint8_t cmd, uint8_t version, uint32_t size)
 	msg->len = NLMSG_HDRLEN + GENL_HDRLEN;
 	msg->size = msg->len + NLMSG_ALIGN(size);
 
-	msg->data = l_malloc(msg->size);
+	msg->data = l_new(unsigned char, msg->size);
 
 	return l_genl_msg_ref(msg);
 }
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] genl: Initialize used memory to avoid valgrind report
  2015-01-30 10:11 [PATCH] genl: Initialize used memory to avoid valgrind report Jukka Rissanen
@ 2015-02-02 15:32 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2015-02-02 15:32 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 1108 bytes --]

Hi Jukka,

On 01/30/2015 04:11 AM, Jukka Rissanen wrote:
> Valgrind reports following error for uninitialized memory usage:
>
>   ==4725== Syscall param socketcall.sendto(msg) points to uninitialised byte(s)
>   ==4725==    at 0x33F5EF6B5D: send (in /usr/lib64/libc-2.17.so)
>   ==4725==    by 0x40BF0E: can_write_data (genl.c:314)
>   ==4725==    by 0x417806: io_callback (io.c:138)
>   ==4725==    by 0x40A282: l_main_run (main.c:346)
>   ==4725==    by 0x401F69: main (main.c:160)
>   ==4725==  Address 0x4c3d092 is 18 bytes inside a block of size 40 alloc'd
>   ==4725==    at 0x4A06409: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
>   ==4725==    by 0x40817D: l_malloc (util.c:62)
>   ==4725==    by 0x40C46A: msg_alloc.constprop.13 (genl.c:243)
>   ==4725==    by 0x40D454: l_genl_family_new (genl.c:641)
>   ==4725==    by 0x405A44: wiphy_init (wiphy.c:1492)
>   ==4725==    by 0x401EDD: main (main.c:154)
>   ==4725==
> ---
>   ell/genl.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>

Patch has been applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-02 15:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-30 10:11 [PATCH] genl: Initialize used memory to avoid valgrind report Jukka Rissanen
2015-02-02 15:32 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.