Skip to contentSkip to conversation

tpm: Fix write to file descriptor function

PATCH In review Stefan Berger 2 participants 2 messages Apr 6, 2016 – Apr 9, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tpm: Fix write to file descriptor function

Fix a bug introduced in commit 46f296c while moving send_all to the tpm_passthrough code. Fix the name of the variable used in the loop.

---
 hw/tpm/tpm_passthrough.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/tpm/tpm_passthrough.c +1 -1
index e98efb7..e88c0d2 100644
@@ -86,7 +86,7 @@ static int tpm_passthrough_unix_write(int fd, const uint8_t *buf, uint32_t len)
     int ret, remain;
 
     remain = len;
-    while (len > 0) {
+    while (remain > 0) {
         ret = write(fd, buf, remain);
         if (ret < 0) {
             if (errno != EINTR && errno != EAGAIN) {
Signature · 1 line
2.5.5
#1 lore raw
Quoted 2 lines · Stefan Berger

Fix a bug introduced in commit 46f296c while moving send_all to the tpm_passthrough code. Fix the name of the variable used in the loop.

Would someone please pick up this fix?

Quoted 18 lines
---
  hw/tpm/tpm_passthrough.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/tpm/tpm_passthrough.c +1 -1
index e98efb7..e88c0d2 100644
@@ -86,7 +86,7 @@ static int tpm_passthrough_unix_write(int fd, const uint8_t *buf, uint32_t len)
      int ret, remain;
 
      remain = len;
-    while (len > 0) {
+    while (remain > 0) {
          ret = write(fd, buf, remain);
          if (ret < 0) {
              if (errno != EINTR && errno != EAGAIN) {