Skip to contentSkip to conversation

tpm: Use EMSGSIZE instead of EBADMSG to compile on OpenBSD

PATCH Superseded Stefan Berger 3 participants 3 messages Oct 11, 2017

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tpm: Use EMSGSIZE instead of EBADMSG to compile on OpenBSD

EMSGSIZE was only added to OpenBSD very recently. To make QEMU compileable on older OpenBSD versions use EMSGSIZE instead when a mismatch between number of received bytes and message size in- dicated in the header was found.

---
 hw/tpm/tpm_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/tpm/tpm_util.c +1 -1
index fb929f6..1129155 100644
@@ -91,7 +91,7 @@ static int tpm_util_test(int fd,
     resp = (struct tpm_resp_hdr *)buf;
     /* check the header */
     if (be32_to_cpu(resp->len) != n) {
-        return EBADMSG;
+        return EMSGSIZE;
     }
 
     *return_tag = be16_to_cpu(resp->tag);
Signature · 1 line
2.5.5
#1 lore raw
Quoted 1 line · Stefan Berger

EMSGSIZE was only added to OpenBSD very recently. To make QEMU

Do you mean "EBADMSG" in this line?

Quoted 23 lines

compileable on older OpenBSD versions use EMSGSIZE instead when a mismatch between number of received bytes and message size in- dicated in the header was found.

---
 hw/tpm/tpm_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/tpm/tpm_util.c +1 -2
index fb929f6..1129155 100644
@@ -91,7 +91,7 @@ static int tpm_util_test(int fd,
     resp = (struct tpm_resp_hdr *)buf;
     /* check the header */
     if (be32_to_cpu(resp->len) != n) {
-        return EBADMSG;
+        return EMSGSIZE;
     }
 
     *return_tag = be16_to_cpu(resp->tag);
--
Quoted 2 lines

2.5.5

thanks
-- PMM

#2 lore raw
In reply to Stefan Berger
This series seems to have some coding style problems. See output below for more information:

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH] tpm: Use EMSGSIZE instead of EBADMSG to compile on OpenBSD

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
5af50e4c64 tpm: Use EMSGSIZE instead of EBADMSG to compile on OpenBSD

=== OUTPUT BEGIN ===
Checking PATCH 1/1: tpm: Use EMSGSIZE instead of EBADMSG to compile on OpenBSD...
ERROR: return of an errno should typically be -ve (return -EMSGSIZE) #23: FILE: hw/tpm/tpm_util.c:69:
+ return EMSGSIZE;

total: 1 errors, 0 warnings, 8 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]