xf86drm: Fix operator precedence
PATCH 1/1 xf86drm: Fix operator precedence
From: Thierry Reding <[email protected]>
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.
--- xf86drm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
xf86drm.c +2 -2
@@ -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;
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 25 lines · Thierry Reding
From: Thierry Reding <[email protected]>
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 <[email protected]>--- xf86drm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)xf86drm.c +1
-1@@ -3606,14 +3606,14 @@ static int drmParseOFDeviceInfo(int maj, int min, char ***compatible)free (value); } - *compatible[i] = tmp_name; + (*compatible)[i] = tmp_name; }
xf86drm.c static int drmParseOFDeviceInfo(int maj, int min, char ***compatible) · line 3619
Quoted 10 lines
xf86drm.c +1
-1return 0 ; free:while (i--) -free (*compatible[i]); +free ((*compatible)[i]);free (*compatible);return err;
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel