From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751722AbeAPPE5 (ORCPT + 1 other); Tue, 16 Jan 2018 10:04:57 -0500 Received: from mail-wm0-f51.google.com ([74.125.82.51]:37004 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751692AbeAPPEy (ORCPT ); Tue, 16 Jan 2018 10:04:54 -0500 X-Google-Smtp-Source: ACJfBov+3ZEziFtKjRtE+2UlRSF/pGjX8Ue9E5YM/l5ptyz6NTP0kAB3KO4fWOq9elrJOGawGCRAsg== Message-ID: <1516115090.12026.24.camel@gmail.com> Subject: Re: [PATCH v2 2/3] trace-cmd: Remove the die() call from read_proc() From: Vladislav Valtchev To: Steven Rostedt Cc: y.karadz@gmail.com, linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 16 Jan 2018 17:04:50 +0200 In-Reply-To: <20180112104355.01ea2c86@gandalf.local.home> References: <20171221152520.25867-1-vladislav.valtchev@gmail.com> <20171221152520.25867-3-vladislav.valtchev@gmail.com> <20180112104355.01ea2c86@gandalf.local.home> Organization: VMware Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Fri, 2018-01-12 at 10:43 -0500, Steven Rostedt wrote: > > But you need to handle the error cases for the users of read_proc(). > From the previous patch: > > static void change_stack_tracer_status(int new_status) > { > char buf[1]; > int status; > int fd; > int n; > > if (read_proc(&status) > 0 && status == new_status) > return; /* nothing to do */ > > We should not continue if read_proc() fails. Should move the die here: > > ret = read_proc(&status); > if (ret < 0) > die("error reading %s", PROC_FILE); > > if (ret > 0 && status == new_status) > return; /* nothing to do */ > > -- Steve > You're totally right. I overlooked at this detail. -- Vladislav Valtchev VMware Open Source Technology Center