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=-3.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from mailout1.w2.samsung.com (mailout1.w2.samsung.com [211.189.100.11]) by gnuweeb.org (Postfix) with ESMTPS id 378417E7BA for ; Fri, 29 Apr 2022 18:20:39 +0000 (UTC) Authentication-Results: gnuweeb.org; dkim=pass (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.a=rsa-sha256 header.s=mail20170921 header.b=UHJNqkdw; dkim-atps=neutral Received: from uscas1p1.samsung.com (unknown [182.198.245.206]) by mailout1.w2.samsung.com (KnoxPortal) with ESMTP id 20220429182037usoutp0157e0647fdc0cd72ef44938bb36ccd31c~qcPsw28xm1531315313usoutp01V; Fri, 29 Apr 2022 18:20:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w2.samsung.com 20220429182037usoutp0157e0647fdc0cd72ef44938bb36ccd31c~qcPsw28xm1531315313usoutp01V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1651256437; bh=iiaBLAY3rnKfT9AvRpznCxUTQ6J6Fzv3ozZdkfVIKyo=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=UHJNqkdwz2A0mmoCYTAt4w3A9ti/QGK5C7ADDWKxDHMRjUwmBHQNHztubKBEflR6N nAbEa8Au+X7u0Q361z6lBiyDBNT40jGMX1AoIc096G56nu/q34EaZmtFE7sFPvWzON NYQVkzHkkiZbs4CQ7cWyW3KHDFJygENh2Tm2PkdM= Received: from ussmges2new.samsung.com (u111.gpu85.samsung.co.kr [203.254.195.111]) by uscas1p1.samsung.com (KnoxPortal) with ESMTP id 20220429182037uscas1p1b6aa06b85f2c09fce6c40dc8e46e9311~qcPskjuiq1904119041uscas1p14; Fri, 29 Apr 2022 18:20:37 +0000 (GMT) Received: from uscas1p1.samsung.com ( [182.198.245.206]) by ussmges2new.samsung.com (USCPEMTA) with SMTP id 03.E8.09642.57C2C626; Fri, 29 Apr 2022 14:20:37 -0400 (EDT) Received: from ussmgxs2new.samsung.com (u91.gpu85.samsung.co.kr [203.254.195.91]) by uscas1p2.samsung.com (KnoxPortal) with ESMTP id 20220429182036uscas1p2bcc8b7a11f758d77f348e5f6d6df3e1c~qcPsIxQym1582715827uscas1p2d; Fri, 29 Apr 2022 18:20:36 +0000 (GMT) X-AuditID: cbfec36f-bfdff700000025aa-9a-626c2c75721e Received: from SSI-EX3.ssi.samsung.com ( [105.128.2.146]) by ussmgxs2new.samsung.com (USCPEXMTA) with SMTP id 68.34.09672.47C2C626; Fri, 29 Apr 2022 14:20:36 -0400 (EDT) Received: from SSI-EX3.ssi.samsung.com (105.128.2.228) by SSI-EX3.ssi.samsung.com (105.128.2.228) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.2375.7; Fri, 29 Apr 2022 11:20:36 -0700 Received: from SSI-EX3.ssi.samsung.com ([105.128.5.228]) by SSI-EX3.ssi.samsung.com ([105.128.5.228]) with mapi id 15.01.2375.007; Fri, 29 Apr 2022 11:20:36 -0700 From: Vincent Fu To: Ammar Faizi , Jens Axboe CC: Alviro Iskandar Setiawan , Niklas Cassel , fio Mailing List , "GNU/Weeb Mailing List" Subject: RE: [PATCH v1 3/8] engines/net: Add ENOMEM handling on a `malloc()` call Thread-Topic: [PATCH v1 3/8] engines/net: Add ENOMEM handling on a `malloc()` call Thread-Index: AQHYW2LIJGiKZbNsvEOOjWUgCBBNza0HNMgg Date: Fri, 29 Apr 2022 18:20:35 +0000 Message-ID: <39a2c859027f491a9bfa7665f0ffd181@samsung.com> In-Reply-To: <20220429004705.260034-4-ammarfaizi2@gnuweeb.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [105.128.2.176] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprBKsWRmVeSWpSXmKPExsWy7djXc7qlOjlJBuuW8Fjc+u1lceP3WiaL 1Xf72Sw+znrBbHHm7k4Wiwd/HrM7sHkcmLaD1ePy2VKP1kObmTw+b5LzaD/QzRTAGsVlk5Ka k1mWWqRvl8CVsX37NdaCNbwVLx5+Zm5gfMrVxcjJISFgIrGlfwYTiC0ksJJRYsafkC5GLiC7 lUnizr/JjDBFLzafZYNIrGWU+HL3AxOE85FRYsLsC+wQzjJGibNPNgFlODjYBDQl3u4vAOkW EXCXmHTqNStIDbPAPkaJFdu+s4AkhAWCJa7tuc0GUi8iECLxaFoSRL2RxJtJ3ewgNouAqsSj zTvBRvIKWEm0fAW7lFPATqJp3yqw4xgFxCS+n1oDFmcWEJe49WQ+E8TRghKLZu9hhrDFJP7t esgGYStK3P/+kh2iXkdiwe5PbBC2tsSyha/B6nmBek/OfMICUS8pcXDFDRaQ8yUEjnBINC+a ATXURWLyvD6oZdISf+8uY4IoameUmLvxC1T3BEaJ60+kIGxriX+d16A280n8/fWIcQKj8iwk h89CctQsJEfNQnLUAkaWVYzipcXFuempxUZ5qeV6xYm5xaV56XrJ+bmbGIGJ5/S/w/k7GK/f +qh3iJGJg/EQowQHs5II75fdGUlCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeZdlbkgUEkhPLEnN Tk0tSC2CyTJxcEo1MG0/GBkR7n9ob1LOJDedgvUJfC6Tenz2NC+8xaw+P88z+ZSc7bWn+/PX BE76sXiP+EP1rD4VP+kz1pPqOXXsmL4sWvtn952vD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9zJ3l+Zdqw2DI6HUqZcGTrjhrt qybb1x/zfSKa43fYJWbWo+mvO177dk/ZepRlvbK2Sfs0a+P9M7nqdaV//lgqucT2lODy5qw8 mW3fvsn4nTfQCz7Cc/XCFYEA381l05tWpex//DUsM2765cC5YoqMIsn8dU9ybq576WCplWbk 6PUzZ42YzS77F/dTzr8K0WMznd2RIjtH+9/bIz8Vnj4wXfk9jEs/U2fD2oS6e++VWIozEg21 mIuKEwFzxNfbPgMAAA== X-CMS-MailID: 20220429182036uscas1p2bcc8b7a11f758d77f348e5f6d6df3e1c CMS-TYPE: 301P X-CMS-RootMailID: 20220429004738uscas1p1cbf243fac53143fc0843b682a78130ff References: <20220429004705.260034-1-ammarfaizi2@gnuweeb.org> <20220429004705.260034-4-ammarfaizi2@gnuweeb.org> List-Id: > -----Original Message----- > From: Ammar Faizi [mailto:ammarfaizi2@gnuweeb.org] > Sent: Thursday, April 28, 2022 8:47 PM > To: Jens Axboe > Cc: Ammar Faizi ; Alviro Iskandar Setiawan > ; Niklas Cassel > ; fio Mailing List ; > GNU/Weeb Mailing List > Subject: [PATCH v1 3/8] engines/net: Add ENOMEM handling on a > `malloc()` call >=20 > From: Ammar Faizi >=20 > Replace `malloc()` + `memset()` with `calloc()` to simplify the call. > `calloc()` zeroes the allocated memory, so we can avoid `memset()`. > Also, handle the `ENOMEM` case. >=20 > Signed-off-by: Ammar Faizi > --- > engines/net.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) >=20 > diff --git a/engines/net.c b/engines/net.c > index c6cec584..24c1463d 100644 > --- a/engines/net.c > +++ b/engines/net.c > @@ -1370,9 +1370,9 @@ static int fio_netio_setup(struct thread_data > *td) > } >=20 > if (!td->io_ops_data) { > - nd =3D malloc(sizeof(*nd)); > - > - memset(nd, 0, sizeof(*nd)); > + nd =3D calloc(1, sizeof(*nd)); > + if (!nd) > + return 1; > nd->listenfd =3D -1; > nd->pipes[0] =3D nd->pipes[1] =3D -1; > td->io_ops_data =3D nd; > @@ -1391,7 +1391,8 @@ static int fio_netio_setup_splice(struct > thread_data *td) > { > struct netio_data *nd; >=20 > - fio_netio_setup(td); > + if (fio_netio_setup(td)) > + return 1; >=20 > nd =3D td->io_ops_data; > if (nd) { > -- > Ammar Faizi Looks good. Reviewed-by: Vincent Fu