Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750999AbdFSScj (ORCPT ); Mon, 19 Jun 2017 14:32:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:45026 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750846AbdFSSci (ORCPT ); Mon, 19 Jun 2017 14:32:38 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8B67A239AD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=acme@kernel.org Date: Mon, 19 Jun 2017 15:32:35 -0300 From: Arnaldo Carvalho de Melo To: Taeung Song Cc: linux-kernel@vger.kernel.org, Jiri Olsa , Namhyung Kim Subject: Re: [PATCH v4 1/5] perf config: Check error cases of {show_spec, set}_config() Message-ID: <20170619183235.GQ3645@kernel.org> References: <1497671197-20450-1-git-send-email-treeze.taeung@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1497671197-20450-1-git-send-email-treeze.taeung@gmail.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.8.0 (2017-02-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1355 Lines: 47 Em Sat, Jun 17, 2017 at 12:46:37PM +0900, Taeung Song escreveu: > show_spec_config() and set_config() can be called multiple times > in the loop in cmd_config(). > However, The error cases of them wasn't checked, so fix it. Thanks, applied. > Reported-by: Arnaldo Carvalho de Melo > Cc: Jiri Olsa > Cc: Namhyung Kim > Signed-off-by: Taeung Song > --- > tools/perf/builtin-config.c | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c > index 7545966..bb1be79 100644 > --- a/tools/perf/builtin-config.c > +++ b/tools/perf/builtin-config.c > @@ -225,10 +225,23 @@ int cmd_config(int argc, const char **argv) > break; > } > > - if (value == NULL) > + if (value == NULL) { > ret = show_spec_config(set, var); > - else > + if (ret < 0) { > + pr_err("%s is not configured: %s\n", > + var, config_filename); > + free(arg); > + break; > + } > + } else { > ret = set_config(set, config_filename, var, value); > + if (ret < 0) { > + pr_err("Failed to set '%s=%s' on %s\n", > + var, value, config_filename); > + free(arg); > + break; > + } > + } > free(arg); > } > } > -- > 2.7.4