chantra / rpms / tpm2-tss

Forked from rpms/tpm2-tss 2 years ago
Clone

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

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