Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp15989279rwd; Mon, 26 Jun 2023 04:23:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4rGHA5DAwb3+7OqctQhTeSKGCDmXxC2Ok57vu3YoA/jLzZkFZghDkXgXaRhtVir+KfqWtM X-Received: by 2002:a05:6a00:2195:b0:668:8579:2f98 with SMTP id h21-20020a056a00219500b0066885792f98mr22359932pfi.29.1687778584974; Mon, 26 Jun 2023 04:23:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687778584; cv=none; d=google.com; s=arc-20160816; b=LOwcon76xo6JciNUxCjygYipqcoJ6flVXZy7RrTQ6byVAOX3iiyRFNrI5vNFXionmE 33i8lFpmulTeGwbkQCEX0Rnf5Q5Av23qRUct3859euXV4lqWh8czkXAVXwRR2WrvTt51 CTuO/NuHQtb0Xt46SgxBEH800A1tCMiZib0yIBs+0FHRvP6UXXuQ2Ow92dxTC7O2tFhZ sxp1OZfmEbS3+1Xm21kvi1VnEuM/2ARj02B8kv+x9+aQcqerHdC/Q/L/t8Sg81ow2wB1 9GFTCL1qszbX/H9lQvMWcmOPpHnP1QXUnxrmbwqZQ8nwFPHE1vkubuvO1noYXoAjEl4r 7bbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=a2yw5DkbMm8NkJaf9g2Httq8BPQ1XbkqRn30sj30r4k=; fh=fWeR3Cyc3YyYNs7QKUEMT2DHrSYPMMFNc3lU0W0YDWw=; b=ry1BzioCHnYl3rBNvlJr2BKQtuoPw2C9GMywgKy49YbJt0IO3IiEFHW1Dk67W4K/4y uMFNhNBtTvQXcFMznRB6pZ5otGESy4buqVbfak4zqj+oJOxO4cNC/Nl19qtcbCBc9y92 4fqssl6VCBmpiH6E0kc4Um478c5arfWh91OHUDOcF8dNMaqj6A7g7257+lqXPlkgNSSM 25FFdntoJI7OlMvIODfZ3MGweN5pEu+gMh9Sq9ceceXJTPXeR6iONQgAeJtlrJCswoCB q319B1ylc+UUzgURieGxki2oYP3CYQQti5EzlfLZKWlhMaQaaGfOzeeDPsXcM0Uc4kaY Kefg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j12-20020a056a00174c00b006434a04f2fcsi4875155pfc.297.2023.06.26.04.22.53; Mon, 26 Jun 2023 04:23:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230422AbjFZLOM (ORCPT + 99 others); Mon, 26 Jun 2023 07:14:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230376AbjFZLOH (ORCPT ); Mon, 26 Jun 2023 07:14:07 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B091010CB; Mon, 26 Jun 2023 04:14:00 -0700 (PDT) X-UUID: 67455abb2ffa49c6924eb7ea88480e97-20230626 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.25,REQID:e137a920-093b-482b-a944-003c1b683ee7,IP:10, URL:0,TC:0,Content:-5,EDM:0,RT:0,SF:-5,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:0 X-CID-INFO: VERSION:1.1.25,REQID:e137a920-093b-482b-a944-003c1b683ee7,IP:10,UR L:0,TC:0,Content:-5,EDM:0,RT:0,SF:-5,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:0 X-CID-META: VersionHash:d5b0ae3,CLOUDID:1897b13f-7aa7-41f3-a6bd-0433bee822f3,B ulkID:230626191352F17JRK00,BulkQuantity:0,Recheck:0,SF:17|19|43|38|23|102, TC:nil,Content:0,EDM:-3,IP:-2,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-UUID: 67455abb2ffa49c6924eb7ea88480e97-20230626 X-User: sunliming@kylinos.cn Received: from localhost.localdomain [(116.232.67.169)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 1512709045; Mon, 26 Jun 2023 19:13:51 +0800 From: sunliming To: rostedt@goodmis.org, beaub@linux.microsoft.com, mhiramat@kernel.org Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, sunliming Subject: [PATCH v4 1/3] tracing/user_events: Fix incorrect return value for writing operation when events are disabled Date: Mon, 26 Jun 2023 19:13:42 +0800 Message-Id: <20230626111344.19136-2-sunliming@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230626111344.19136-1-sunliming@kylinos.cn> References: <20230626111344.19136-1-sunliming@kylinos.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The writing operation return the count of writes regardless of whether events are enabled or disabled. Switch it to return -EBADF to indicates that the event is disabled. Signed-off-by: sunliming --- kernel/trace/trace_events_user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c index 1ac5ba5685ed..146bb2e9758f 100644 --- a/kernel/trace/trace_events_user.c +++ b/kernel/trace/trace_events_user.c @@ -1957,7 +1957,8 @@ static ssize_t user_events_write_core(struct file *file, struct iov_iter *i) if (unlikely(faulted)) return -EFAULT; - } + } else + return -EBADF; return ret; } -- 2.25.1