From: Andrew Yang <andrew.yang@mediatek.com>
To: <rostedt@goodmis.org>
Cc: <andrew.yang@mediatek.com>, <casper.li@mediatek.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>,
<linux-mediatek@lists.infradead.org>, <matthias.bgg@gmail.com>,
<mhiramat@kernel.org>
Subject: Re: [PATCH v2] mm/writeback: fix dereferencing NULL mapping->host
Date: Wed, 30 Nov 2022 16:23:03 +0800 [thread overview]
Message-ID: <20221130082303.30859-2-andrew.yang@mediatek.com> (raw)
In-Reply-To: <20221130082303.30859-1-andrew.yang@mediatek.com>
On Tue, 2022-11-29 at 09:56 -0500, Steven Rostedt wrote:
> On Tue, 29 Nov 2022 11:32:59 +0800
> Andrew Yang <andrew.yang@mediatek.com> wrote:
>
> > From: "andrew.yang" <andrew.yang@mediatek.com>
> >
> > Check before dereferencing mapping->host
> >
> > Signed-off-by: andrew.yang <andrew.yang@mediatek.com>
> > ---
> > include/trace/events/writeback.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/include/trace/events/writeback.h
> > b/include/trace/events/writeback.h
> > index 86b2a82da546..56f6e114d3ed 100644
> > --- a/include/trace/events/writeback.h
> > +++ b/include/trace/events/writeback.h
> > @@ -68,7 +68,7 @@ DECLARE_EVENT_CLASS(writeback_folio_template,
> > strscpy_pad(__entry->name,
> > bdi_dev_name(mapping ?
> > inode_to_bdi(mapping->host) :
> > NULL), 32);
> > - __entry->ino = mapping ? mapping->host->i_ino : 0;
> > + __entry->ino = mapping && mapping->host ? mapping-
> > >host->i_ino : 0;
>
> I hate remembering precedence. Can we add parenthesis around this to
> be
> clear?
>
> __entry->ino = (mapping && mapping->host) ? mapping-
> >host->i_ino : 0;
>
> Thanks,
>
> -- Steve
>
>
> > __entry->index = folio->index;
> > ),
> >
>
>
Sure, that's a good suggestion
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2022-11-30 8:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-29 3:32 [PATCH] mm/writeback: fix dereferencing NULL mapping->host Andrew Yang
2022-11-29 14:56 ` Steven Rostedt
2022-11-30 8:23 ` [PATCH v2] " Andrew Yang
2022-11-30 8:23 ` Andrew Yang [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=20221130082303.30859-2-andrew.yang@mediatek.com \
--to=andrew.yang@mediatek.com \
--cc=casper.li@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
/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;
as well as URLs for NNTP newsgroup(s).