From: Jani Nikula <jani.nikula@linux.intel.com>
To: Gustavo Padovan <gustavo@padovan.org>,
Daniel Vetter <daniel.vetter@intel.com>,
dri-devel@lists.freedesktop.org
Cc: Dave Airlie <airlied@redhat.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH v2] drm/dp/mst: Fix off-by-one typo when dump payload table
Date: Wed, 28 Mar 2018 09:22:38 +0300 [thread overview]
Message-ID: <87tvt0yb0x.fsf@intel.com> (raw)
In-Reply-To: <20180319141932.37290-1-andriy.shevchenko@linux.intel.com>
On Mon, 19 Mar 2018, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> It seems there is a classical off-by-one typo from the beginning
> when commit
>
> ad7f8a1f9ced ("drm/helper: add Displayport multi-stream helper (v0.6)")
>
> introduced a new helper.
>
> Fix a typo by introducing a macro constant.
>
> Cc: Dave Airlie <airlied@redhat.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Pushed to drm-misc-next, thanks for the patch!
BR,
Jani.
> ---
> - use macro for buffer length on stack
>
> drivers/gpu/drm/drm_dp_mst_topology.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 6fac4129e6a2..658830620ca3 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -2941,12 +2941,14 @@ static void drm_dp_mst_dump_mstb(struct seq_file *m,
> }
> }
>
> +#define DP_PAYLOAD_TABLE_SIZE 64
> +
> static bool dump_dp_payload_table(struct drm_dp_mst_topology_mgr *mgr,
> char *buf)
> {
> int i;
>
> - for (i = 0; i < 64; i += 16) {
> + for (i = 0; i < DP_PAYLOAD_TABLE_SIZE; i += 16) {
> if (drm_dp_dpcd_read(mgr->aux,
> DP_PAYLOAD_TABLE_UPDATE_STATUS + i,
> &buf[i], 16) != 16)
> @@ -3015,7 +3017,7 @@ void drm_dp_mst_dump_topology(struct seq_file *m,
>
> mutex_lock(&mgr->lock);
> if (mgr->mst_primary) {
> - u8 buf[64];
> + u8 buf[DP_PAYLOAD_TABLE_SIZE];
> int ret;
>
> ret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf, DP_RECEIVER_CAP_SIZE);
> @@ -3033,8 +3035,7 @@ void drm_dp_mst_dump_topology(struct seq_file *m,
> seq_printf(m, " revision: hw: %x.%x sw: %x.%x\n",
> buf[0x9] >> 4, buf[0x9] & 0xf, buf[0xa], buf[0xb]);
> if (dump_dp_payload_table(mgr, buf))
> - seq_printf(m, "payload table: %*ph\n", 63, buf);
> -
> + seq_printf(m, "payload table: %*ph\n", DP_PAYLOAD_TABLE_SIZE, buf);
> }
>
> mutex_unlock(&mgr->lock);
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
prev parent reply other threads:[~2018-03-28 6:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-19 14:19 [PATCH v2] drm/dp/mst: Fix off-by-one typo when dump payload table Andy Shevchenko
2018-03-28 6:22 ` Jani Nikula [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=87tvt0yb0x.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=airlied@redhat.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gustavo@padovan.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