All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Binns <frank.binns@imgtec.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: Eric Engestrom <eric.engestrom@intel.com>,
	dri-devel@lists.freedesktop.org,
	Emil Velikov <emil.velikov@collabora.com>
Subject: Re: [PATCH libdrm] xf86drm: Fix operator precedence
Date: Wed, 20 Feb 2019 11:59:41 +0000	[thread overview]
Message-ID: <87bm36oeky.fsf@imgtec.com> (raw)
In-Reply-To: <20190220111725.14673-1-thierry.reding@gmail.com>

Reviewed-by: Frank Binns <frank.binns@imgtec.com>

Thierry Reding <thierry.reding@gmail.com> writes:

> From: Thierry Reding <treding@nvidia.com>
>
> The array subscription operator ([]) has higher precedence than the
> indirection operator (*), so we need to use parentheses to properly
> instruct the compiler to dereference the pointer to an array first,
> and then subscript into the array.
>
> Fixes a crash observed on Tegra.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
>  xf86drm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/xf86drm.c b/xf86drm.c
> index d006bb38f800..5de37083c9a3 100644
> --- a/xf86drm.c
> +++ b/xf86drm.c
> @@ -3606,14 +3606,14 @@ static int drmParseOFDeviceInfo(int maj, int min, char ***compatible)
>              free(value);
>          }
>  
> -        *compatible[i] = tmp_name;
> +        (*compatible)[i] = tmp_name;
>      }
>  
>      return 0;
>  
>  free:
>      while (i--)
> -        free(*compatible[i]);
> +        free((*compatible)[i]);
>  
>      free(*compatible);
>      return err;

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      reply	other threads:[~2019-02-20 12:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-20 11:17 [PATCH libdrm] xf86drm: Fix operator precedence Thierry Reding
2019-02-20 11:59 ` Frank Binns [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=87bm36oeky.fsf@imgtec.com \
    --to=frank.binns@imgtec.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.velikov@collabora.com \
    --cc=eric.engestrom@intel.com \
    --cc=thierry.reding@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.