From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <bruce.richardson@intel.com>
Received: from mga06.intel.com (mga06.intel.com [134.134.136.31])
 by dpdk.org (Postfix) with ESMTP id 2DCC34C96;
 Fri, 29 Mar 2019 17:24:22 +0100 (CET)
X-Amp-Result: UNSCANNABLE
X-Amp-File-Uploaded: False
Received: from orsmga003.jf.intel.com ([10.7.209.27])
 by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 29 Mar 2019 09:24:21 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.60,284,1549958400"; d="scan'208";a="138376053"
Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.35])
 by orsmga003.jf.intel.com with SMTP; 29 Mar 2019 09:24:19 -0700
Received: by  (sSMTP sendmail emulation); Fri, 29 Mar 2019 16:24:18 +0000
Date: Fri, 29 Mar 2019 16:24:18 +0000
From: Bruce Richardson <bruce.richardson@intel.com>
To: David Hunt <david.hunt@intel.com>
Cc: dev@dpdk.org, anatoly.burakov@intel.com, stable@dpdk.org
Message-ID: <20190329162417.GA1432@bricha3-MOBL.ger.corp.intel.com>
References: <20190329161142.39787-1-david.hunt@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20190329161142.39787-1-david.hunt@intel.com>
User-Agent: Mutt/1.11.4 (2019-03-13)
Subject: Re: [dpdk-dev] [PATCH] lib/power: fix governor storage to trim
 newlines
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 29 Mar 2019 16:24:23 -0000

On Fri, Mar 29, 2019 at 04:11:42PM +0000, David Hunt wrote:
> Currently the Power Libray stores the governor name with an embedded
> newline read from the scaling_governor sysfs file. This patch strips
> it out.
> 
> Fixes: 445c6528b55f ("power: common interface for guest and host")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Hunt <david.hunt@intel.com>
> ---
>  lib/librte_power/power_acpi_cpufreq.c   | 4 ++++
>  lib/librte_power/power_pstate_cpufreq.c | 4 ++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/lib/librte_power/power_acpi_cpufreq.c b/lib/librte_power/power_acpi_cpufreq.c
> index 45412f0b9..c2febdf06 100644
> --- a/lib/librte_power/power_acpi_cpufreq.c
> +++ b/lib/librte_power/power_acpi_cpufreq.c
> @@ -147,6 +147,10 @@ power_set_governor_userspace(struct rte_power_info *pi)
>  
>  	s = fgets(buf, sizeof(buf), f);
>  	FOPS_OR_NULL_GOTO(s, out);
> +	buf[BUFSIZ-1] = '\0';

Should not be needed as fgets null-terminates.

" fgets() reads in at most one less than size characters from stream and
stores them into the buffer pointed to by s.  Reading stops after an EOF or
a newline.  If a newline is read, it is stored into the buffer.  A
terminating null byte ('\0') is stored after the last character in the
buffer."

/Bruce

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id 18B09A05D3
	for <public@inbox.dpdk.org>; Fri, 29 Mar 2019 17:24:26 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 168EC4C99;
	Fri, 29 Mar 2019 17:24:25 +0100 (CET)
Received: from mga06.intel.com (mga06.intel.com [134.134.136.31])
 by dpdk.org (Postfix) with ESMTP id 2DCC34C96;
 Fri, 29 Mar 2019 17:24:22 +0100 (CET)
X-Amp-Result: UNSCANNABLE
X-Amp-File-Uploaded: False
Received: from orsmga003.jf.intel.com ([10.7.209.27])
 by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 29 Mar 2019 09:24:21 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.60,284,1549958400"; d="scan'208";a="138376053"
Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.35])
 by orsmga003.jf.intel.com with SMTP; 29 Mar 2019 09:24:19 -0700
Received: by  (sSMTP sendmail emulation); Fri, 29 Mar 2019 16:24:18 +0000
Date: Fri, 29 Mar 2019 16:24:18 +0000
From: Bruce Richardson <bruce.richardson@intel.com>
To: David Hunt <david.hunt@intel.com>
Cc: dev@dpdk.org, anatoly.burakov@intel.com, stable@dpdk.org
Message-ID: <20190329162417.GA1432@bricha3-MOBL.ger.corp.intel.com>
References: <20190329161142.39787-1-david.hunt@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
In-Reply-To: <20190329161142.39787-1-david.hunt@intel.com>
User-Agent: Mutt/1.11.4 (2019-03-13)
Subject: Re: [dpdk-dev] [PATCH] lib/power: fix governor storage to trim
 newlines
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>
Message-ID: <20190329162418.R_HEHnboyRGFs_UYbIoGel7Z91u068NSQFBfPZtK4jY@z>

On Fri, Mar 29, 2019 at 04:11:42PM +0000, David Hunt wrote:
> Currently the Power Libray stores the governor name with an embedded
> newline read from the scaling_governor sysfs file. This patch strips
> it out.
> 
> Fixes: 445c6528b55f ("power: common interface for guest and host")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Hunt <david.hunt@intel.com>
> ---
>  lib/librte_power/power_acpi_cpufreq.c   | 4 ++++
>  lib/librte_power/power_pstate_cpufreq.c | 4 ++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/lib/librte_power/power_acpi_cpufreq.c b/lib/librte_power/power_acpi_cpufreq.c
> index 45412f0b9..c2febdf06 100644
> --- a/lib/librte_power/power_acpi_cpufreq.c
> +++ b/lib/librte_power/power_acpi_cpufreq.c
> @@ -147,6 +147,10 @@ power_set_governor_userspace(struct rte_power_info *pi)
>  
>  	s = fgets(buf, sizeof(buf), f);
>  	FOPS_OR_NULL_GOTO(s, out);
> +	buf[BUFSIZ-1] = '\0';

Should not be needed as fgets null-terminates.

" fgets() reads in at most one less than size characters from stream and
stores them into the buffer pointed to by s.  Reading stops after an EOF or
a newline.  If a newline is read, it is stored into the buffer.  A
terminating null byte ('\0') is stored after the last character in the
buffer."

/Bruce