lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200831180844.GA3992970@elver.google.com>
Date:   Mon, 31 Aug 2020 20:08:44 +0200
From:   Marco Elver <elver@...gle.com>
To:     SeongJae Park <sjpark@...zon.com>
Cc:     akpm@...ux-foundation.org, SeongJae Park <sjpark@...zon.de>,
        Jonathan.Cameron@...wei.com, aarcange@...hat.com, acme@...nel.org,
        alexander.shishkin@...ux.intel.com, amit@...nel.org,
        benh@...nel.crashing.org, brendan.d.gregg@...il.com,
        brendanhiggins@...gle.com, cai@....pw, colin.king@...onical.com,
        corbet@....net, david@...hat.com, dwmw@...zon.com,
        fan.du@...el.com, foersleo@...zon.de, gthelen@...gle.com,
        irogers@...gle.com, jolsa@...hat.com, kirill@...temov.name,
        mark.rutland@....com, mgorman@...e.de, minchan@...nel.org,
        mingo@...hat.com, namhyung@...nel.org, peterz@...radead.org,
        rdunlap@...radead.org, riel@...riel.com, rientjes@...gle.com,
        rostedt@...dmis.org, rppt@...nel.org, sblbir@...zon.com,
        shakeelb@...gle.com, shuah@...nel.org, sj38.park@...il.com,
        snu@...zon.de, vbabka@...e.cz, vdavydov.dev@...il.com,
        yang.shi@...ux.alibaba.com, ying.huang@...el.com,
        zgf574564920@...il.com, linux-damon@...zon.com, linux-mm@...ck.org,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC v8 01/10] mm/damon/debugfs: Allow users to set initial
 monitoring target regions

On Mon, Aug 31, 2020 at 12:47PM +0200, SeongJae Park wrote:
[...]
> diff --git a/mm/damon.c b/mm/damon.c
> index 7e3c8c82a010..9815d22fc4de 100644
> --- a/mm/damon.c
> +++ b/mm/damon.c
> @@ -2001,6 +2001,147 @@ static ssize_t debugfs_record_write(struct file *file,
>  	return ret;
>  }
>  
> +static ssize_t sprint_init_regions(struct damon_ctx *c, char *buf, ssize_t len)
> +{
> +	struct damon_target *t;
> +	struct damon_region *r;
> +	int written = 0;
> +	int rc;
> +
> +	damon_for_each_target(t, c) {
> +		damon_for_each_region(r, t) {
> +			rc = snprintf(&buf[written], len - written,
> +					"%lu %lu %lu\n",
> +					t->id, r->ar.start, r->ar.end);

This most likely will not work as intended, because snprintf() returns
"[...] the number of characters which would be generated for the given
input, excluding the trailing null [...]". Would scnprintf() -- which
returns "[...] the number of characters written into @buf not including
the trailing '\0' [...]" -- do what you intended?

> +			if (!rc)
> +				return -ENOMEM;
> +			written += rc;
> +		}
> +	}
> +	return written;
> +}
[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ