From: Dan Carpenter <dan.carpenter@oracle.com>
To: Lucas Stach <l.stach@pengutronix.de>,
Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: David Airlie <airlied@linux.ie>,
kernel-janitors@vger.kernel.org, etnaviv@lists.freedesktop.org,
dri-devel@lists.freedesktop.org,
Russell King <linux+etnaviv@armlinux.org.uk>
Subject: Re: [PATCH] drm/etnaviv: fix some off by one bugs
Date: Fri, 21 Dec 2018 20:24:06 +0000 [thread overview]
Message-ID: <20181221202406.GF2240@kadam> (raw)
In-Reply-To: <20180713145631.qxd3pzk72v4bshii@kili.mountain>
I don't think anyone responded to this one?
regards,
dan carpenter
On Fri, Jul 13, 2018 at 06:00:18PM +0300, Dan Carpenter wrote:
> The ->nr_signal is the supposed to be the number of elements in the
> ->signal array. There was one place where it was 5 but it was supposed
> to be 4. That looks like a copy and paste bug. There were also two
> checks that were off by one.
>
> Fixes: 9e2c2e273012 ("drm/etnaviv: add infrastructure to query perf counter")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Not tested.
>
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c
> index 9980d81a26e3..4227a4006c34 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c
> @@ -113,7 +113,7 @@ static const struct etnaviv_pm_domain doms_3d[] = {
> .name = "PE",
> .profile_read = VIVS_MC_PROFILE_PE_READ,
> .profile_config = VIVS_MC_PROFILE_CONFIG0,
> - .nr_signals = 5,
> + .nr_signals = 4,
> .signal = (const struct etnaviv_pm_signal[]) {
> {
> "PIXEL_COUNT_KILLED_BY_COLOR_PIPE",
> @@ -435,7 +435,7 @@ int etnaviv_pm_query_sig(struct etnaviv_gpu *gpu,
>
> dom = meta->domains + signal->domain;
>
> - if (signal->iter > dom->nr_signals)
> + if (signal->iter >= dom->nr_signals)
> return -EINVAL;
>
> sig = &dom->signal[signal->iter];
> @@ -461,7 +461,7 @@ int etnaviv_pm_req_validate(const struct drm_etnaviv_gem_submit_pmr *r,
>
> dom = meta->domains + r->domain;
>
> - if (r->signal > dom->nr_signals)
> + if (r->signal >= dom->nr_signals)
> return -EINVAL;
>
> return 0;
next prev parent reply other threads:[~2018-12-21 20:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-13 15:00 [PATCH] drm/etnaviv: fix some off by one bugs Dan Carpenter
2018-12-21 20:24 ` Dan Carpenter [this message]
2018-12-24 9:32 ` Daniel Vetter
2019-01-07 8:42 ` Lucas Stach
2019-01-07 10:00 ` Daniel Vetter
2018-12-28 22:08 ` Christian Gmeiner
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=20181221202406.GF2240@kadam \
--to=dan.carpenter@oracle.com \
--cc=airlied@linux.ie \
--cc=christian.gmeiner@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=etnaviv@lists.freedesktop.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=l.stach@pengutronix.de \
--cc=linux+etnaviv@armlinux.org.uk \
/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