Re: valgrind spews

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2018-03-22 at 11:23 -0600, Jens Axboe wrote:
> On 3/22/18 11:12 AM, Bart Van Assche wrote:
> > Where is the sk_out structure allocated? Can Valgrind know whether or not
> > that structure has been initialized?
> 
> In server.c:accept_loop() and that structure is memset at alloc
> time as it's coming out of smalloc().

Would you be OK with changing that smalloc() call into scalloc() such that
Valgrind knows that that structure is initialized? On my laptop the following
is sufficient to suppress the complaints mentioned in my previous e-mail:

diff --git a/server.c b/server.c
index 15dc2c4b38ba..d3f69774165f 100644
--- a/server.c
+++ b/server.c
@@ -1359,7 +1359,7 @@ static int accept_loop(int listen_sk)
 
 		dprint(FD_NET, "server: connect from %s\n", from);
 
-		sk_out = smalloc(sizeof(*sk_out));
+		sk_out = scalloc(1, sizeof(*sk_out));
 		if (!sk_out) {
 			close(sk);
 			return -1;

Thanks,

Bart.

��.n��������+%������w��{.n�������^n�r������&��z�ޗ�zf���h���~����������_��+v���)ߣ�

[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux