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: <f3322e41-1891-a33b-daaa-731ec548ec4e@collabora.com>
Date:   Tue, 30 May 2023 12:06:00 +0200
From:   AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>
To:     Yunfei Dong <yunfei.dong@...iatek.com>,
        Chen-Yu Tsai <wenst@...omium.org>,
        Nicolas Dufresne <nicolas.dufresne@...labora.com>,
        Hans Verkuil <hverkuil-cisco@...all.nl>,
        Benjamin Gaignard <benjamin.gaignard@...labora.com>,
        NĂ­colas F . R . A . Prado 
        <nfraprado@...labora.com>, Nathan Hebert <nhebert@...omium.org>
Cc:     Hsin-Yi Wang <hsinyi@...omium.org>,
        Fritz Koenig <frkoenig@...omium.org>,
        Daniel Vetter <daniel@...ll.ch>,
        Steve Cho <stevecho@...omium.org>, linux-media@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org,
        linux-mediatek@...ts.infradead.org,
        Project_Global_Chrome_Upstream_Group@...iatek.com
Subject: Re: [PATCH v5,8/8] media: mediatek: vcodec: Add dbgfs help function

Il 25/05/23 04:12, Yunfei Dong ha scritto:
> Getting dbgfs help information with command "echo -help > vdec".
> 
> Signed-off-by: Yunfei Dong <yunfei.dong@...iatek.com>
> ---
>   .../mediatek/vcodec/mtk_vcodec_dbgfs.c        | 24 ++++++++++++++++++-
>   1 file changed, 23 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c
> index 237d0dc8a1fc..2372fc449b45 100644
> --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c
> +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c
> @@ -52,6 +52,23 @@ static void mtk_vdec_dbgfs_get_format_type(struct mtk_vcodec_ctx *ctx, char *buf
>   	*used += curr_len;
>   }
>   
> +static void mtk_vdec_dbgfs_get_help(char *buf, int *used, int total)
> +{
> +	int curr_len;
> +
> +	curr_len = snprintf(buf + *used, total - *used,
> +			    "help: (1: echo -'info' > vdec 2: cat vdec)\n");
> +	*used += curr_len;
> +
> +	curr_len = snprintf(buf + *used, total - *used,
> +			    "\t-picinfo: get resolution\n");
> +	*used += curr_len;
> +
> +	curr_len = snprintf(buf + *used, total - *used,
> +			    "\t-format: get output & capture queue format\n");
> +	*used += curr_len;
> +}
> +
>   static ssize_t mtk_vdec_dbgfs_write(struct file *filp, const char __user *ubuf,
>   				    size_t count, loff_t *ppos)
>   {
> @@ -84,6 +101,11 @@ static ssize_t mtk_vdec_dbgfs_read(struct file *filp, char __user *ubuf,
>   	if (!buf)
>   		return -ENOMEM;
>   
> +	if (strstr(dbgfs->dbgfs_buf, "-help")) {

I would print the help strings in two conditions:
1. -help
2. (nothing)

...so that if you don't echo anything to vdec (no params), you get the help text.
Otherwise, you would have to know that "-help" is a parameter that gives you help
text in the first place.

As for this commit "as is", it works as intended and it is useful to retrieve
the help text; you can either send a followup commit that extends the help to
the corner case that I've explained, or send a v6 adding that to this same commit.

I would prefer to see a v6 -- BUT -- since this series was sent a long time ago,
you will get my R-b and I will leave the final choice to Hans.

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ