Blame SOURCES/0001-tcti-device-getPollHandles-should-allow-num_handles-.patch

b9d646
From c42450a294c4267998aa16a477e9218ee5953aa9 Mon Sep 17 00:00:00 2001
b9d646
From: Jeffrey Ferreira <jeffpferreira@gmail.com>
b9d646
Date: Thu, 19 Sep 2019 13:32:00 -0700
b9d646
Subject: [PATCH] tcti-device: getPollHandles should allow num_handles query
b9d646
b9d646
Signed-off-by: Jeffrey Ferreira <jeffpferreira@gmail.com>
b9d646
---
b9d646
 src/tss2-tcti/tcti-device.c | 11 +++++++++--
b9d646
 1 file changed, 9 insertions(+), 2 deletions(-)
b9d646
b9d646
diff --git a/src/tss2-tcti/tcti-device.c b/src/tss2-tcti/tcti-device.c
b9d646
index 44c9fe2083d5..53a698cad061 100644
b9d646
--- a/src/tss2-tcti/tcti-device.c
b9d646
+++ b/src/tss2-tcti/tcti-device.c
b9d646
@@ -368,12 +368,19 @@ tcti_device_get_poll_handles (
b9d646
         return TSS2_TCTI_RC_BAD_CONTEXT;
b9d646
     }
b9d646
 
b9d646
-    if (handles == NULL || num_handles == NULL) {
b9d646
+    if (num_handles == NULL) {
b9d646
         return TSS2_TCTI_RC_BAD_REFERENCE;
b9d646
     }
b9d646
 
b9d646
+    if (handles != NULL && *num_handles < 1) {
b9d646
+        return TSS2_TCTI_RC_INSUFFICIENT_BUFFER;
b9d646
+    }
b9d646
+
b9d646
     *num_handles = 1;
b9d646
-    handles->fd = tcti_dev->fd;
b9d646
+    if (handles != NULL) {
b9d646
+        handles->fd = tcti_dev->fd;
b9d646
+    }
b9d646
+
b9d646
     return TSS2_RC_SUCCESS;
b9d646
 #else
b9d646
     (void)(tctiContext);
b9d646
-- 
b9d646
2.27.0
b9d646