From: Philo Lu <lulie@linux.alibaba.com>
To: zhangzhengming <zhang.zhengming@h3c.com>
Cc: akpm@linux-foundation.org, alibuda@linux.alibaba.com,
dust.li@linux.alibaba.com, gregkh@linuxfoundation.org,
guwen@linux.alibaba.com, hengqi@linux.alibaba.com,
kunyu@nfschina.com, linux-kernel@vger.kernel.org,
nabijaczleweli@nabijaczleweli.xyz, xuanzhuo@linux.alibaba.com,
zhao_lei1@hoperun.com, zhou.kete@h3c.com
Subject: Re: [PATCH] relay: avoid relay_open_buf inproperly fails in buffer-only mode
Date: Fri, 15 Mar 2024 11:22:53 +0800 [thread overview]
Message-ID: <2f93789c-e931-452a-9b42-43c3254b626f@linux.alibaba.com> (raw)
In-Reply-To: <20240315023912.13390-1-zhang.zhengming@h3c.com>
On 2024/3/15 10:39, zhangzhengming wrote:
>> 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.
>
This would be fine. AFAICT the return value here is un-important. So
reverting to `WARN_ON(dentry)` maybe another choice.
prev parent reply other threads:[~2024-03-15 3:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-20 10:58 Philo Lu
2024-03-15 2:39 ` zhangzhengming
2024-03-15 3:22 ` Philo Lu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2f93789c-e931-452a-9b42-43c3254b626f@linux.alibaba.com \
--to=lulie@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=alibuda@linux.alibaba.com \
--cc=dust.li@linux.alibaba.com \
--cc=gregkh@linuxfoundation.org \
--cc=guwen@linux.alibaba.com \
--cc=hengqi@linux.alibaba.com \
--cc=kunyu@nfschina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nabijaczleweli@nabijaczleweli.xyz \
--cc=xuanzhuo@linux.alibaba.com \
--cc=zhang.zhengming@h3c.com \
--cc=zhao_lei1@hoperun.com \
--cc=zhou.kete@h3c.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®