Re: [PATCH] virt/coco/sev-guest: Initialize err in handle_guest_request

From: Borislav Petkov
Date: Thu Oct 27 2022 - 05:45:45 EST


On Wed, Oct 19, 2022 at 12:58:12PM -0700, Dionna Amalie Glaze wrote:
> fw_err = 0xff doesn't make sense to me actually. It's not a documented
> code that the firmware was never called.
> Still, we can simply pass fw_err to snp_issue_guest_request rather
> than an unsigned long err, since a null pointer results in an -EINVAL.

Yes, pls do that. Such I/O function args are always a PITA anyway.

In retrospect, that handle_guest_request() with gazillion args should
have been made to take a struct as a single argument and populate it as
it operates.

The callers then would look at it and decide what to do.

Looking at the callers, they all take members of struct
snp_guest_request_ioctl and pass them in. A first step in cleaning that
up could be to simply pass that struct snp_guest_request_ioctl pointer
instead...

Oh well, in case folks feel bored. :-)

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette