Re: [PATCH] ext4/inode.c: remove dead stores in mpage_process_page()

Nghia Le <[email protected]> Fri, 22 Oct 2021 00:46:24 +0700
Newsgroups tech.elisa.lists.linux-safety
Message-ID <CADkY59vMu_MnDR3rH7EC_-wapFRELahveRQ2iHfO9oewBjCdiA@mail.gmail.com>
--000000000000de4c7d05cee079b1
Content-Type: text/plain; charset="UTF-8"

Dear Lukas,
Thanks for your comments, I submitted  patch v2 for the revision
Best regards,
Nghia Le

On Thu, Oct 21, 2021 at 10:57 PM Lukas Bulwahn <[email protected]>
wrote:

> On Thu, Oct 21, 2021 at 2:50 AM Nghia Le <[email protected]> wrote:
> >
> > The command "make clang-analyzer" detected dead stores.
> >
>
> Use present tense here. s/detected/detects/
>
> > Removed the all the assignments io_end_size=0 to fix dead stores, as
> > io_end_size is never read.
> >
>
> Use imperative here. So: s/Removed/Remove/
>
> drop the first "the".
>
> Maybe a better wording is:
>
> Do not reset io_end_size to 0 in the current paths, as the function
> exists on those paths without further using io_end_size.
>
> ... and the subject line could be "ext4: remove useless resetting
> io_end_size in mpage_process_page()".
>
> I hope this helps.
>
> Lukas
>
> > Signed-off-by: Nghia Le <[email protected]>
> > ---
> >  fs/ext4/inode.c | 2 --
> >  1 file changed, 2 deletions(-)
> >
> > diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> > index 0f06305167d5..03efed2ed1ea 100644
> > --- a/fs/ext4/inode.c
> > +++ b/fs/ext4/inode.c
> > @@ -2260,7 +2260,6 @@ static int mpage_process_page(struct mpage_da_data
> *mpd, struct page *page,
> >                         mpd->map.m_len = 0;
> >                         mpd->map.m_flags = 0;
> >                         io_end_vec->size += io_end_size;
> > -                       io_end_size = 0;
> >
> >                         err = mpage_process_page_bufs(mpd, head, bh,
> lblk);
> >                         if (err > 0)
> > @@ -2285,7 +2284,6 @@ static int mpage_process_page(struct mpage_da_data
> *mpd, struct page *page,
> >         } while (lblk++, (bh = bh->b_this_page) != head);
> >
> >         io_end_vec->size += io_end_size;
> > -       io_end_size = 0;
> >         *map_bh = false;
> >  out:
> >         *m_lblk = lblk;
> > --
> > 2.25.1
> >
>

--000000000000de4c7d05cee079b1
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Dear Lukas,<div>Thanks for your comments, I submitted=C2=
=A0 patch v2 for the revision</div><div>Best regards,</div><div>Nghia Le</d=
iv></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_att=
r">On Thu, Oct 21, 2021 at 10:57 PM Lukas Bulwahn &lt;<a href=3D"mailto:luk=
[email protected]">[email protected]</a>&gt; wrote:<br></div><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:=
1px solid rgb(204,204,204);padding-left:1ex">On Thu, Oct 21, 2021 at 2:50 A=
M Nghia Le &lt;<a href=3D"mailto:[email protected]" target=3D"_blank">ngh=
[email protected]</a>&gt; wrote:<br>
&gt;<br>
&gt; The command &quot;make clang-analyzer&quot; detected dead stores.<br>
&gt;<br>
<br>
Use present tense here. s/detected/detects/<br>
<br>
&gt; Removed the all the assignments io_end_size=3D0 to fix dead stores, as=
<br>
&gt; io_end_size is never read.<br>
&gt;<br>
<br>
Use imperative here. So: s/Removed/Remove/<br>
<br>
drop the first &quot;the&quot;.<br>
<br>
Maybe a better wording is:<br>
<br>
Do not reset io_end_size to 0 in the current paths, as the function<br>
exists on those paths without further using io_end_size.<br>
<br>
... and the subject line could be &quot;ext4: remove useless resetting<br>
io_end_size in mpage_process_page()&quot;.<br>
<br>
I hope this helps.<br>
<br>
Lukas<br>
<br>
&gt; Signed-off-by: Nghia Le &lt;<a href=3D"mailto:[email protected]" tar=
get=3D"_blank">[email protected]</a>&gt;<br>
&gt; ---<br>
&gt;=C2=A0 fs/ext4/inode.c | 2 --<br>
&gt;=C2=A0 1 file changed, 2 deletions(-)<br>
&gt;<br>
&gt; diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c<br>
&gt; index 0f06305167d5..03efed2ed1ea 100644<br>
&gt; --- a/fs/ext4/inode.c<br>
&gt; +++ b/fs/ext4/inode.c<br>
&gt; @@ -2260,7 +2260,6 @@ static int mpage_process_page(struct mpage_da_da=
ta *mpd, struct page *page,<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0mpd-&gt;map.m_len =3D 0;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0mpd-&gt;map.m_flags =3D 0;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0io_end_vec-&gt;size +=3D io_end_size;<br>
&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0io_end_size =3D 0;<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0err =3D mpage_process_page_bufs(mpd, head, bh, lblk);<b=
r>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0if (err &gt; 0)<br>
&gt; @@ -2285,7 +2284,6 @@ static int mpage_process_page(struct mpage_da_da=
ta *mpd, struct page *page,<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} while (lblk++, (bh =3D bh-&gt;b_thi=
s_page) !=3D head);<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0io_end_vec-&gt;size +=3D io_end_size;=
<br>
&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0io_end_size =3D 0;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*map_bh =3D false;<br>
&gt;=C2=A0 out:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*m_lblk =3D lblk;<br>
&gt; --<br>
&gt; 2.25.1<br>
&gt;<br>
</blockquote></div>

--000000000000de4c7d05cee079b1--