* [PATCH libdrm] xf86drm: Fix operator precedence
@ 2019-02-20 11:17 Thierry Reding
2019-02-20 11:59 ` Frank Binns
0 siblings, 1 reply; 2+ messages in thread
From: Thierry Reding @ 2019-02-20 11:17 UTC (permalink / raw)
To: Emil Velikov; +Cc: Eric Engestrom, dri-devel
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;
--
2.20.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH libdrm] xf86drm: Fix operator precedence
2019-02-20 11:17 [PATCH libdrm] xf86drm: Fix operator precedence Thierry Reding
@ 2019-02-20 11:59 ` Frank Binns
0 siblings, 0 replies; 2+ messages in thread
From: Frank Binns @ 2019-02-20 11:59 UTC (permalink / raw)
To: Thierry Reding; +Cc: Eric Engestrom, dri-devel, Emil Velikov
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-02-20 12:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-20 11:17 [PATCH libdrm] xf86drm: Fix operator precedence Thierry Reding
2019-02-20 11:59 ` Frank Binns
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.