From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9F994A0C43; Fri, 15 Oct 2021 19:40:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8529040692; Fri, 15 Oct 2021 19:40:31 +0200 (CEST) Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by mails.dpdk.org (Postfix) with ESMTP id A391B4003C for ; Fri, 15 Oct 2021 19:40:30 +0200 (CEST) Received: by mail-pj1-f50.google.com with SMTP id nn3-20020a17090b38c300b001a03bb6c4ebso7816014pjb.1 for ; Fri, 15 Oct 2021 10:40:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NxSdBV0FRH/DvV8HY4V5baJHhMtwI36fKRtrfDU1Cqk=; b=YsC3mimccJ9/gqOBrdc6XklwOfR0LQMCKICKfiOA3Fg7AbKRm2HOaqz17UJBmyKVTV hJ+Skjs2vpurUj8832wqH4dRY14o6uA1sJ/5f5Sjnl6d/TJdUF522PfZmq8IGMY2Wrlr hbZw5urRA5dDSibLvwMR9ytV8HdJi5ceVjScvQAoa8Uv+EjjDfA2PxMkH8LVKnHTUWax JeCoFy5QhSCxjuoR5W68SphV5WLfswxMW12igKZVhx7W/rABB4kJ65g+XmOVpFqALzMj azmRQVq4B26WsKRVGknFzfDAFNn6K79Ulchtfr8ek/CJZBQ2uc1SSQHdanjo2yMDPbLy H8Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NxSdBV0FRH/DvV8HY4V5baJHhMtwI36fKRtrfDU1Cqk=; b=viQM06RpgVLY5gkm7XAZnysJPe7R6sgW7xakJLuPy99I9pxK/Ht+rRg/ajszH2TsYn dzl2T4e9oeapPKod6fkGFx83s+UoOI/Naw1QuNVo2G+dAY7vBbE93OPix5uxCycY2HPx j532c8bwqW3qZ/5OjacA5OVFX+jegRyPIYag0kw5OlAfdOIrDjD7J51RX0RXKbAITHOm CS/LnDsrCuH4nr1FDhguQCGXRSwPzy+YCFbVwY/pvnTAWLSw8bBOBZeUqzxilL6vw8jx N+cjEahI13Myk1vQQI/Li58AsvLfC6McDAKVla/WbrnRYvoSdcqDtFh4aFjNpYwme7uN jmsQ== X-Gm-Message-State: AOAM531+McWA8WuUhBJduIztPL7hluZWtVC4ifyjzMdbwWPVECidytNQ mZAMWiJoMNKchyBkpZvfcJTt+oNWCpI7TQ== X-Google-Smtp-Source: ABdhPJz8Gf3uTBCPix/Gw0Xplf5ippb7z45fHSjvzOumS2OoCpLPdXxoZd9M3gJgPPDRssTG8zqgjQ== X-Received: by 2002:a17:903:248f:b029:128:d5ea:18a7 with SMTP id p15-20020a170903248fb0290128d5ea18a7mr12188681plw.83.1634319629730; Fri, 15 Oct 2021 10:40:29 -0700 (PDT) Received: from hermes.local (204-195-33-123.wavecable.com. [204.195.33.123]) by smtp.gmail.com with ESMTPSA id ls7sm5690095pjb.16.2021.10.15.10.40.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 10:40:29 -0700 (PDT) Date: Fri, 15 Oct 2021 10:40:26 -0700 From: Stephen Hemminger To: "Pattan, Reshma" Cc: "dev@dpdk.org" Message-ID: <20211015104026.59e8364b@hermes.local> In-Reply-To: References: <20210903004732.109023-1-stephen@networkplumber.org> <20211001162705.442298-1-stephen@networkplumber.org> <20211001162705.442298-3-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v12 02/12] librte_pcapng: add new library for writing pcapng files X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, 15 Oct 2021 09:36:00 +0000 "Pattan, Reshma" wrote: > > + buf = calloc(1, len); > > + if (!buf) > > + return -1; > > How about returning -ENOMEM It could but not necessary. The other code is returning result of write and therefore would be -1 on write error. This is in internal local function and the only caller is just checking for < 0. PS: In reality, malloc can't fail on Linux. Process gets oom killed instead (unless someone has gone and tweaked the memory allocator to not overcommit).