From patchwork Wed Sep 16 15:35:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 518449 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (unknown [IPv6:2600:3c00::f03c:91ff:fe6e:bdf7]) by ozlabs.org (Postfix) with ESMTP id 4D3811401AF for ; Thu, 17 Sep 2015 01:35:47 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 519EA10B2C; Wed, 16 Sep 2015 08:35:46 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v1.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 251FF10B27 for ; Wed, 16 Sep 2015 08:35:45 -0700 (PDT) Received: from bar3.cudamail.com (bar1 [192.168.15.1]) by mx3v1.cudamail.com (Postfix) with ESMTP id 89D586181ED for ; Wed, 16 Sep 2015 09:35:44 -0600 (MDT) X-ASG-Debug-ID: 1442417743-03dd7b58bf01cd0001-byXFYA Received: from mx3-pf3.cudamail.com ([192.168.14.3]) by bar3.cudamail.com with ESMTP id 99fzoNjlfULHZoVr (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 16 Sep 2015 09:35:43 -0600 (MDT) X-Barracuda-Envelope-From: blp@nicira.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.3 Received: from unknown (HELO mail-pa0-f53.google.com) (209.85.220.53) by mx3-pf3.cudamail.com with ESMTPS (RC4-SHA encrypted); 16 Sep 2015 15:35:41 -0000 Received-SPF: unknown (mx3-pf3.cudamail.com: Multiple SPF records returned) X-Barracuda-RBL-Trusted-Forwarder: 209.85.220.53 Received: by padhy16 with SMTP id hy16so212430914pad.1 for ; Wed, 16 Sep 2015 08:35:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-type:content-transfer-encoding; bh=kjyhwkGKJv44LK5ftJUJ/HSJGvCfBx3rHM6B0YXoebw=; b=JzBe42FyedjOklFBUFel1gdkumFj51pnN8Zro+1kfTAcFfh0OXgYTqst+syf4iJk7N z9vEkr8g6rUZ3D+Sf2el/gYi0MkLsqk0rweAwxLR/EeK1kCv6zC8x4KN2ltsaZTCiYVr 9PUilWla9tNhQkTE93cIR5C5o+5c6X8lkFSp+Bc6Za5cHc7XTMLYZohQhKnObfEqy8LS KFMDogd3wyO2K7EuDBcrha9YS0Z3ulby622yKHriCPOgwVXs8FulLKMqKQUlkU6ekFSi 0V15P/JojoQ3V83WgtOW9L1r7Yq1sGNCDWCE3f2Vw7UOVyySDwpb2pbWnsAEwdLioi+r nQEQ== X-Gm-Message-State: ALoCoQnCjdzgAYNXFDHWcJwCQu+d7/WX0ameUicxwZgf9isx9sHJpucMPcA9d8VSER6zzMeWoWAi X-Received: by 10.66.139.133 with SMTP id qy5mr61071178pab.44.1442417742790; Wed, 16 Sep 2015 08:35:42 -0700 (PDT) Received: from sigabrt.benpfaff.org (173-228-112-165.dsl.dynamic.fusionbroadband.com. [173.228.112.165]) by smtp.gmail.com with ESMTPSA id ej3sm28565860pbd.13.2015.09.16.08.35.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Sep 2015 08:35:41 -0700 (PDT) X-CudaMail-Envelope-Sender: blp@nicira.com X-Barracuda-Apparent-Source-IP: 173.228.112.165 From: Ben Pfaff To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V3-915028149 X-CudaMail-DTE: 091615 X-CudaMail-Originating-IP: 209.85.220.53 Date: Wed, 16 Sep 2015 08:35:33 -0700 X-ASG-Orig-Subj: [##CM-V3-915028149##][PATCH] ofproto-dpif-sflow: Use xzalloc() instead of calloc() to allocate memory. Message-Id: <1442417733-12498-1-git-send-email-blp@nicira.com> X-Mailer: git-send-email 2.1.3 MIME-Version: 1.0 X-Barracuda-Connect: UNKNOWN[192.168.14.3] X-Barracuda-Start-Time: 1442417743 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH] ofproto-dpif-sflow: Use xzalloc() instead of calloc() to allocate memory. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@openvswitch.org Sender: "dev" Memory allocation shouldn't be allowed to fail. CC: Neil McKee Reported-by: neeraj mehta Reported-at: http://openvswitch.org/pipermail/discuss/2015-September/018776.html Signed-off-by: Ben Pfaff Acked-by: Russell Bryant --- AUTHORS | 1 + ofproto/ofproto-dpif-sflow.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index a7f40bb..b348942 100644 --- a/AUTHORS +++ b/AUTHORS @@ -385,6 +385,7 @@ ankur dwivedi ankurengg2003@gmail.com chen zhang 3zhangchen9211@gmail.com kk yap yapkke@stanford.edu likunyun kunyunli@hotmail.com +neeraj mehta mehtaneeraj07@gmail.com rahim entezari rahim.entezari@gmail.com 俊 赵 zhaojun12@outlook.com 冯全树(Crab) fqs888@126.com diff --git a/ofproto/ofproto-dpif-sflow.c b/ofproto/ofproto-dpif-sflow.c index 260c01b..d479997 100644 --- a/ofproto/ofproto-dpif-sflow.c +++ b/ofproto/ofproto-dpif-sflow.c @@ -136,7 +136,7 @@ static void * sflow_agent_alloc_cb(void *magic OVS_UNUSED, SFLAgent *agent OVS_UNUSED, size_t bytes) { - return calloc(1, bytes); + return xzalloc(bytes); } /* sFlow library callback to free memory. */