Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp662163imi; Thu, 21 Jul 2022 08:31:54 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vO8cKlRdsOE1wrNcuk4OrRn84tuDknP7jMHR5egblbtnz/WHLkO2URgswughUZh2untDyD X-Received: by 2002:a65:6056:0:b0:419:78b3:e612 with SMTP id a22-20020a656056000000b0041978b3e612mr39437575pgp.252.1658417513967; Thu, 21 Jul 2022 08:31:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658417513; cv=none; d=google.com; s=arc-20160816; b=GjsS5WpPOg+Ca09vhzSV5baoiuB1bPNfxq/dMKWYCFg7KTpO/kaGbNWaH5QmKIhADI Kn1InZcl/dlBJEPtauBT9TE6x53JVGRMxeXz8uKXPTQesV+gHzoPSUMmo/7fAWtq8ixF 6PajIim6IlAt0Ni0jEDaJ5Zh1s+OhMcrLbHXASsL7/rH6ZfQAwbOVRfVfao2FNSVSNnA n5XClX8lNknSAoG8gQ5f651EZLfOAhrC7RzT2Q+gvLMM29GMOWJaieXY1J+XxMbcsss2 AFhKmySOCveHJYRxqUeMbr7c/xOiorVcPwNnfx1PUfsw7pFGYS/rb7JJkgCq5pEi2uP5 mLig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=y7NIy/sFvH7jcPjQz5rMP0tVdv+pcC943zyadbA9JMA=; b=hhnhOQoDZGr3oVqlOMABFG8ctCYTQfcwJHwZVID5meOE6Aam8J0RNHBGMTrle7qAai J/roZn+zQudHort24173F+gbLou+ugtPAhhhzIKvVz78UNqK7ZUnzYc2fQgYSknN9Gr8 +V0n+FZhr9bNfIaWnWdPuGIrF90LAlJ66SAnQFjmAMKN5hH3lvduYdA8W7+3hvoP67g/ N+4eZjFWx9r7W1V1i0jhBThwa8hoF7FUNgfA9O3Q4eA78AOigyM/C/4nlyOUzBNW9Nj4 rDqe8ZRc3EjkXk/SQYm2Um56C/4hVgrGizgj0ne8UPR6FN+zaOx11YdIxuckkuW5Gikn IeoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="L0F5YCg/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kk18-20020a17090b4a1200b001f02b575643si2536749pjb.101.2022.07.21.08.31.38; Thu, 21 Jul 2022 08:31:53 -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; dkim=pass header.i=@linux.dev header.s=key1 header.b="L0F5YCg/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229588AbiGUOij (ORCPT + 99 others); Thu, 21 Jul 2022 10:38:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229528AbiGUOii (ORCPT ); Thu, 21 Jul 2022 10:38:38 -0400 Received: from out1.migadu.com (out1.migadu.com [IPv6:2001:41d0:2:863f::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DAB085F96; Thu, 21 Jul 2022 07:38:37 -0700 (PDT) Date: Thu, 21 Jul 2022 22:38:25 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1658414315; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=y7NIy/sFvH7jcPjQz5rMP0tVdv+pcC943zyadbA9JMA=; b=L0F5YCg/mY7nY9yWcaH8KzsTSg1GLC6SMZLH7EW7kL8sbqMO5Gu2Mz68CsIhU8JslpyEx+ BAkn7T5mS+VxVOZPAzPXfVhJOHkaWg2ePTD7fIWopZqwVLXHGRqRCYmMpHctSa+gXAX8z+ bbslSjgmX4YHZJxhdAewvyOGQW1srDc= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Tao Zhou To: Daniel Bristot de Oliveira Cc: Steven Rostedt , Wim Van Sebroeck , Guenter Roeck , Jonathan Corbet , Ingo Molnar , Thomas Gleixner , Peter Zijlstra , Will Deacon , Catalin Marinas , Marco Elver , Dmitry Vyukov , "Paul E. McKenney" , Shuah Khan , Gabriele Paoloni , Juri Lelli , Clark Williams , Randy Dunlap , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-devel@vger.kernel.org, Tao Zhou Subject: Re: [PATCH V6 01/16] rv: Add Runtime Verification (RV) interface Message-ID: References: <69bb4c369b4f6f12014eb9ca3c28b74e4378c007.1658244826.git.bristot@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <69bb4c369b4f6f12014eb9ca3c28b74e4378c007.1658244826.git.bristot@kernel.org> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_PASS 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 On Tue, Jul 19, 2022 at 07:27:06PM +0200, Daniel Bristot de Oliveira wrote: > +#include > +#include > +#include > +#include > +#include > + > +#include "rv.h" > + > +DEFINE_MUTEX(rv_interface_lock); > +/* > + * Enable a given monitor. > + */ > +static int enable_monitor(struct rv_monitor_def *mdef) > +{ > + int retval; > + > + if (!mdef->monitor->enabled) { > + retval = mdef->monitor->enable(); > + if (retval) > + return retval; > + } > + > + mdef->monitor->enabled = 1; This should be placed at the end of the last if block. Otherwise another assignment may be duplicated because it is already 1 now. no?(not sure how compiler treat this..) > + > +/* > + * Interface to read the enable/disable status of a monitor. I see the 'status' but look a little more this function is about the description of monitor, so: /* Interface to read the description message of a monitor */ or others. > + */ > +static ssize_t monitor_desc_read_data(struct file *filp, char __user *user_buf, size_t count, > + loff_t *ppos) > +{ > + struct rv_monitor_def *mdef = filp->private_data; > + char buff[256]; > + > + memset(buff, 0, sizeof(buff)); > + > + mutex_lock(&rv_interface_lock); > + snprintf(buff, sizeof(buff), "%s\n", mdef->monitor->description); > + mutex_unlock(&rv_interface_lock);