xfree86: modesetting: don't use VLA
even through this specific case is correct and safe, it's safer to remove all VLA usages and forbid them completely by compiler flag. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1819>
This commit is contained in:
parent
a0834009cf
commit
f894801fa2
|
@ -1910,8 +1910,9 @@ drmmode_set_gamma_lut(drmmode_crtc_private_ptr drmmode_crtc,
|
||||||
drmmode_prop_info_ptr gamma_lut_info =
|
drmmode_prop_info_ptr gamma_lut_info =
|
||||||
&drmmode_crtc->props[DRMMODE_CRTC_GAMMA_LUT];
|
&drmmode_crtc->props[DRMMODE_CRTC_GAMMA_LUT];
|
||||||
const uint32_t crtc_id = drmmode_crtc->mode_crtc->crtc_id;
|
const uint32_t crtc_id = drmmode_crtc->mode_crtc->crtc_id;
|
||||||
uint32_t blob_id;
|
struct drm_color_lut *lut = calloc(size, sizeof(struct drm_color_lut));
|
||||||
struct drm_color_lut lut[size];
|
if (!lut)
|
||||||
|
return;
|
||||||
|
|
||||||
assert(gamma_lut_info->prop_id != 0);
|
assert(gamma_lut_info->prop_id != 0);
|
||||||
|
|
||||||
|
@ -1922,13 +1923,17 @@ drmmode_set_gamma_lut(drmmode_crtc_private_ptr drmmode_crtc,
|
||||||
lut[i].reserved = 0;
|
lut[i].reserved = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drmModeCreatePropertyBlob(drmmode->fd, lut, sizeof(lut), &blob_id))
|
uint32_t blob_id;
|
||||||
|
if (drmModeCreatePropertyBlob(drmmode->fd, lut, sizeof(lut), &blob_id)) {
|
||||||
|
free(lut);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
drmModeObjectSetProperty(drmmode->fd, crtc_id, DRM_MODE_OBJECT_CRTC,
|
drmModeObjectSetProperty(drmmode->fd, crtc_id, DRM_MODE_OBJECT_CRTC,
|
||||||
gamma_lut_info->prop_id, blob_id);
|
gamma_lut_info->prop_id, blob_id);
|
||||||
|
|
||||||
drmModeDestroyPropertyBlob(drmmode->fd, blob_id);
|
drmModeDestroyPropertyBlob(drmmode->fd, blob_id);
|
||||||
|
free(lut);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue