From: Markus Armbruster <armbru@redhat.com>
To: Stefan Berger <stefanb@linux.ibm.com>
Cc: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>,
stefanb@linux.vnet.ibm.com, qemu-devel@nongnu.org,
peterx@redhat.com
Subject: Re: [PATCH 2/3] tpm_emulator: drop direct use of errno variable
Date: Sat, 08 Nov 2025 10:35:04 +0100 [thread overview]
Message-ID: <87tsz46f5j.fsf@pond.sub.org> (raw)
In-Reply-To: <bd855481-a93a-4406-bd0d-a02896b93296@linux.ibm.com> (Stefan Berger's message of "Fri, 7 Nov 2025 14:31:48 -0500")
Stefan Berger <stefanb@linux.ibm.com> writes:
> On 11/6/25 2:41 PM, Vladimir Sementsov-Ogievskiy wrote:
>> The code tends to include errno into error messages after
>> tpm_util_test_tpmdev() and tpm_emulator_ctrlcmd() calls.
>> Both has error paths, where errno is not set, examples:
>
> Both have ...>
>> tpm_emulator_ctrlcmd()
>> qemu_chr_fe_write_all()
>> qemu_chr_write()
>> replay_char_write_event_load()
>> ...
>> *res = replay_get_dword();
>> ...
>> tpm_util_test_tpmdev()
>> tpm_util_test()
>> tpm_util_request()
>> ...
>> if (n != requestlen) {
>> return -EFAULT;
>> }
>> ...
>> Both doesn't document that they set errno.
>
> Both do not ...
>
>> Let's drop these explicit usage of errno. If we need this information,
>> it should be added to errp deeper in the stack.
>
> It's not clear to me why this is an actual problem. Is it better to now not set this error message?
Error messages lacking information are bad. Error messages with
incorrect information are *worse*. When the error message lacks
information I need, I usually realize it immediately. When it lies to
me, I don't.
Before this patch, correct information is mixed up with incorrect
information. At the point where we format it into error messages, we
have no idea whether it's correct. Thus, the error messages lie at
least some of the time. That's a bug.
The patch fixes that bug at the cost of losing some correct information
along with the lies.
If you'd rather lose just the lies, that's possible, but more involved.
As the saying goes: patches welcome!
[...]
next prev parent reply other threads:[~2025-11-08 9:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-06 19:41 [PATCH 0/3] follow-up for tpm_emulator errp story Vladimir Sementsov-Ogievskiy
2025-11-06 19:41 ` [PATCH 1/3] tpm_emulator: print error on error-ignore path Vladimir Sementsov-Ogievskiy
2025-11-07 19:27 ` Stefan Berger
2025-11-06 19:41 ` [PATCH 2/3] tpm_emulator: drop direct use of errno variable Vladimir Sementsov-Ogievskiy
2025-11-07 19:31 ` Stefan Berger
2025-11-07 19:53 ` Vladimir Sementsov-Ogievskiy
2025-11-08 9:35 ` Markus Armbruster [this message]
2025-11-10 14:51 ` Stefan Berger
2025-11-06 19:41 ` [PATCH 3/3] tpm_emulator: tpm_emulator_set_state_blobs(): move to boolean return Vladimir Sementsov-Ogievskiy
2025-11-07 19:35 ` Stefan Berger
2025-11-07 8:39 ` [PATCH 0/3] follow-up for tpm_emulator errp story Markus Armbruster
2026-01-19 15:47 ` Vladimir Sementsov-Ogievskiy
2026-01-19 19:41 ` Stefan Berger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tsz46f5j.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanb@linux.ibm.com \
--cc=stefanb@linux.vnet.ibm.com \
--cc=vsementsov@yandex-team.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.