From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,NO_DNS_FOR_FROM, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from [192.168.88.87] (unknown [180.246.147.8]) by gnuweeb.org (Postfix) with ESMTPSA id 020897E77D; Tue, 26 Apr 2022 21:31:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1651008685; bh=3LzE8C95PLV/+rKJ187lBXmNVk3IybQXyfystODe/Vg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=KHAJ+4qa1ztY7Tfr8Tc7gu24FjIw6iy5oO7ygnHVBUm19dtVUuzJrfIRnAjl8ma8J feVo8oNkNIeKgBi12AkM9Grbp0oQEgz5Del3s9gfzB6EW/nxX2ysoqmXGeO8EJ99DS gKdhg9ivXwXLGpLjwXjnt2ORKKyHp8CCWgE77sMilsEQA2+A7LBqD1h0tLGv45b41e rkpHHcpCATepo6BSbxh7tFxNvQ247pw53byq6Njisc3vz/e7SZVRCkVf4MpLEOixL6 52nyNTfhSuwnaDUmJTawGCEL2Zpetg+JiKf2atURP9Hz5C6/euvsNL7poVtagBMDP7 yNakwLofneRZQ== Message-ID: Date: Wed, 27 Apr 2022 04:31:12 +0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v1 4/6] engines/net: Replace `malloc()`+`memset()` with `calloc()` Content-Language: en-US To: Jens Axboe Cc: fio Mailing List , GNU/Weeb Mailing List References: <20220426212044.78898-1-ammarfaizi2@gnuweeb.org> <20220426212044.78898-5-ammarfaizi2@gnuweeb.org> From: Ammar Faizi In-Reply-To: <20220426212044.78898-5-ammarfaizi2@gnuweeb.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: On 4/27/22 4:20 AM, Ammar Faizi wrote: > diff --git a/engines/net.c b/engines/net.c > index c6cec584..8a898748 100644 > --- a/engines/net.c > +++ b/engines/net.c > @@ -1363,6 +1363,10 @@ static int fio_netio_setup(struct thread_data *td) > { > struct netio_data *nd; > > + nd = calloc(1, sizeof(*nd)); > + if (!nd) > + return 1; This is also a wrong calloc() placement, will fix that in v2. I will make sure to self-review carefully before send this time. > if (!td->files_index) { > add_file(td, td->o.filename ?: "net", 0, 0); > td->o.nr_files = td->o.nr_files ?: 1; > @@ -1370,9 +1374,6 @@ static int fio_netio_setup(struct thread_data *td) > } > > if (!td->io_ops_data) { > - nd = malloc(sizeof(*nd)); > - > - memset(nd, 0, sizeof(*nd)); > nd->listenfd = -1; > nd->pipes[0] = nd->pipes[1] = -1; > td->io_ops_data = nd; > @@ -1391,7 +1392,8 @@ static int fio_netio_setup_splice(struct thread_data *td) > { > struct netio_data *nd; > > - fio_netio_setup(td); > + if (fio_netio_setup(td)) > + return 1; > > nd = td->io_ops_data; > if (nd) { -- Ammar Faizi