From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7B46C43334 for ; Thu, 21 Jul 2022 14:38:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229662AbiGUOij (ORCPT ); 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 Precedence: bulk List-ID: X-Mailing-List: linux-doc@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);