From: Julia Lawall <julia.lawall@lip6.fr>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: Kim Phillips <kim.phillips@freescale.com>,
kernel-janitors@vger.kernel.org,
Paul Mackerras <paulus@samba.org>,
linuxppc-dev@lists.ozlabs.org,
Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH] powerpc/ipic: Fix a bounds check in ipic_set_priority()
Date: Wed, 5 Dec 2018 13:06:37 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.20.1812051305420.3726@hadrien> (raw)
In-Reply-To: <87sgzckwm3.fsf@concordia.ellerman.id.au>
On Wed, 5 Dec 2018, Michael Ellerman wrote:
> Julia Lawall <julia.lawall@lip6.fr> writes:
> > On Wed, 5 Dec 2018, Michael Ellerman wrote:
> >
> >> Hi Dan,
> >>
> >> Thanks for the patch.
> >>
> >> Dan Carpenter <dan.carpenter@oracle.com> writes:
> >> > The ipic_info[] array only has 95 elements so I have made the bounds
> >> > check smaller to prevent a read overflow. It was Smatch that found
> >> > this issue:
> >> >
> >> > arch/powerpc/sysdev/ipic.c:784 ipic_set_priority()
> >> > error: buffer overflow 'ipic_info' 95 <= 127
> >> >
> >> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >> > ---
> >> > I wasn't able to find any callers of this code. Maybe we removed the
> >> > last one in commit b9f0f1bb2bca ("[POWERPC] Adapt ipic driver to new
> >> > host_ops interface, add set_irq_type to set IRQ sense"). So perhaps we
> >> > should just remove it. I'm not really comfortable doing that myself,
> >> > because I don't know the code well enough and can't build test
> >> > it properly.
> >>
> >> Hah wow, last usage removed in 2006!
> >>
> >> I don't see any mention of it since then, so I'll remove it. If it
> >> breaks something we can put it back.
> >>
> >> Can smatch help us find things like this that are defined non-static but
> >> never used?
> >
> > I wrote a Coccinelle script for this, that just uses grep. Of course the
> > results need checking because uses can be constructed within macros using
> > #.
>
> That would be cool. I can't immediately see it in scripts/coccinelle, is
> it somewhere else?
No, it needs improvement... I'll try to do something with it soon. I
don't think it is well suited to scrips/coccinelle, because it needs to
know where the kernel tree is to do the grep.
julia
>
> > Are things that are defined static but are never used useful to keep
> > around?
>
> No, but the compiler will usually tell us about them via -Wunused-function.
>
> cheers
>
next prev parent reply other threads:[~2018-12-05 12:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-03 14:48 [PATCH] powerpc/ipic: Fix a bounds check in ipic_set_priority() Dan Carpenter
2018-12-05 3:26 ` Michael Ellerman
2018-12-05 8:11 ` Julia Lawall
2018-12-05 12:04 ` Michael Ellerman
2018-12-05 12:06 ` Julia Lawall [this message]
2018-12-06 7:18 ` Christophe LEROY
2018-12-06 8:12 ` Julia Lawall
2018-12-11 14:26 ` Dan Carpenter
2018-12-07 2:07 ` Michael Ellerman
2018-12-10 12:05 ` Christophe Leroy
2018-12-06 9:34 ` Dan Carpenter
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=alpine.DEB.2.20.1812051305420.3726@hadrien \
--to=julia.lawall@lip6.fr \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kim.phillips@freescale.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.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).