From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id C9B27A05D3 for ; Fri, 26 Apr 2019 16:10:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6724D1B6CA; Fri, 26 Apr 2019 16:10:20 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 2E2261B215; Fri, 26 Apr 2019 16:10:14 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Apr 2019 07:10:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,397,1549958400"; d="scan'208";a="153992243" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.251.92.20]) ([10.251.92.20]) by orsmga002.jf.intel.com with ESMTP; 26 Apr 2019 07:10:12 -0700 To: David Hunt , dev@dpdk.org Cc: stable@dpdk.org References: <20190426112422.15719-1-david.hunt@intel.com> <20190426140454.29684-1-david.hunt@intel.com> From: "Burakov, Anatoly" Message-ID: <691b68a8-8663-3dcc-72d3-d9c16eda788b@intel.com> Date: Fri, 26 Apr 2019 15:10:12 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190426140454.29684-1-david.hunt@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v3] examples/vm_power_manager: fix string null termination X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On 26-Apr-19 3:04 PM, David Hunt wrote: > coverity complains about a null-termination after a read, > so we terminate once we exit the do-while read loop. > > Coverity issue: 337680 > Fixes: a63504a90f ("examples/power: add JSON string handling") > CC: stable@dpdk.org > > Signed-off-by: David Hunt > > --- > v2: Move null termination outside of do-while. > v3: Simplify null termimation > --- > examples/vm_power_manager/channel_monitor.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c > index 971e4f2bc..4a287109b 100644 > --- a/examples/vm_power_manager/channel_monitor.c > +++ b/examples/vm_power_manager/channel_monitor.c > @@ -822,12 +822,7 @@ read_json_packet(struct channel_info *chan_info) > break; > } while (indent > 0); > > - if (indent > 0) > - /* > - * We've broken out of the read loop without getting > - * a closing brace, so throw away the data > - */ > - json_data[idx] = 0; > + json_data[idx] = '\0'; > > if (strlen(json_data) == 0) > continue; > Reviewed-by: Anatoly Burakov -- Thanks, Anatoly