aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXin Li2018-07-19 15:50:12 -0500
committerXin Li2018-07-19 15:50:12 -0500
commit52368c4ddf4be018cf9e4a9cd71864e6a9e8d978 (patch)
treeca66046d2a8da649b72a65cc30e6f6eadde22329
parent1d7a660cddea85ac87e01b76b44baa663777ed40 (diff)
parentf517f86364f4f160281ef0bfbcbb27fcdbfb3650 (diff)
downloadexternal-libdrm-52368c4ddf4be018cf9e4a9cd71864e6a9e8d978.tar.gz
external-libdrm-52368c4ddf4be018cf9e4a9cd71864e6a9e8d978.tar.xz
external-libdrm-52368c4ddf4be018cf9e4a9cd71864e6a9e8d978.zip
Merge pi-dev-plus-aosp-without-vendor into stage-dr1-aosp-master
Bug: 111615259 Change-Id: I25a175251a1c1240604bf79c8e12f221b4ab1374
-rw-r--r--xf86drmMode.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/xf86drmMode.c b/xf86drmMode.c
index 9a15b5e7..b0ec609b 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -1250,7 +1250,7 @@ drmModeAtomicReqPtr drmModeAtomicDuplicate(drmModeAtomicReqPtr old)
1250 return NULL; 1250 return NULL;
1251 } 1251 }
1252 memcpy(new->items, old->items, 1252 memcpy(new->items, old->items,
1253 old->size_items * sizeof(*new->items)); 1253 old->cursor * sizeof(*new->items));
1254 } else { 1254 } else {
1255 new->items = NULL; 1255 new->items = NULL;
1256 } 1256 }
@@ -1312,12 +1312,13 @@ int drmModeAtomicAddProperty(drmModeAtomicReqPtr req,
1312 return -EINVAL; 1312 return -EINVAL;
1313 1313
1314 if (req->cursor >= req->size_items) { 1314 if (req->cursor >= req->size_items) {
1315 const uint32_t item_size_inc = getpagesize() / sizeof(*req->items);
1315 drmModeAtomicReqItemPtr new; 1316 drmModeAtomicReqItemPtr new;
1316 1317
1317 req->size_items += 16; 1318 req->size_items += item_size_inc;
1318 new = realloc(req->items, req->size_items * sizeof(*req->items)); 1319 new = realloc(req->items, req->size_items * sizeof(*req->items));
1319 if (!new) { 1320 if (!new) {
1320 req->size_items -= 16; 1321 req->size_items -= item_size_inc;
1321 return -ENOMEM; 1322 return -ENOMEM;
1322 } 1323 }
1323 req->items = new; 1324 req->items = new;