lkml.org 
[lkml]   [2022]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V6 01/16] rv: Add Runtime Verification (RV) interface
On Tue, Jul 19, 2022 at 07:27:06PM +0200, Daniel Bristot de Oliveira wrote:

> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/init.h>
> +#include <linux/slab.h>
> +#include <rv/rv.h>
> +
> +#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);

\
 
 \ /
  Last update: 2022-07-21 16:39    [W:0.731 / U:0.984 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site