[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240315023912.13390-1-zhang.zhengming@h3c.com>
Date: Fri, 15 Mar 2024 10:39:12 +0800
From: zhangzhengming <zhang.zhengming@....com>
To: <lulie@...ux.alibaba.com>
CC: <akpm@...ux-foundation.org>, <alibuda@...ux.alibaba.com>,
<dust.li@...ux.alibaba.com>, <gregkh@...uxfoundation.org>,
<guwen@...ux.alibaba.com>, <hengqi@...ux.alibaba.com>,
<kunyu@...china.com>, <linux-kernel@...r.kernel.org>,
<nabijaczleweli@...ijaczleweli.xyz>, <xuanzhuo@...ux.alibaba.com>,
<zhang.zhengming@....com>, <zhao_lei1@...erun.com>,
<zhou.kete@....com>
Subject: Re: [PATCH] relay: avoid relay_open_buf inproperly fails in buffer-only mode
> diff --git a/kernel/relay.c b/kernel/relay.c
> index a8e90e98bf2c..0d8b8325530a 100644
> --- a/kernel/relay.c
> +++ b/kernel/relay.c
> @@ -391,12 +391,13 @@ static struct rchan_buf *relay_open_buf(struct rchan *chan, unsigned int cpu)
> goto free_buf;
> relay_set_buf_dentry(buf, dentry);
> } else {
> - /* Only retrieve global info, nothing more, nothing less */
> + /* In buffer-only mode, relay_open_buf is called with
> + * filename=NULL, but create_buf_file is still needed to
> + * retrieve is_global info. So dentry should be NULL here.
> + */
> dentry = chan->cb->create_buf_file(NULL, NULL,
> S_IRUSR, buf,
> &chan->is_global);
> - if (IS_ERR_OR_NULL(dentry))
> - goto free_buf;
> }
>
> buf->cpu = cpu;
I suggest replacing IS_ERR_OR_NULL with IS_ERR instead of removing it due to the possibility of create_buf_file callback returning an error.
Powered by blists - more mailing lists