Re: [PATCH] crypto: qat - Don't use -EFAULT as error code during setkey()

From: Herbert Xu

Date: Fri Nov 20 2026 - 05:01:26 EST


On Mon, Aug 24, 2026 at 02:24:02PM +0200, Thomas Huth wrote:
> EFAULT means "Bad Address", it's the error code that is meant to
> be returned when userspace provided the kerknel with a pointer to
> memory that is not part of its address space. However, the QAT driver
> abuses this error code during its setkey() function to signal that
> there was something wrong with the selected algorithm, which is just
> confusing.
>
> The best choice for an error code would likely have been EINVAL here,
> but qat_alg_aead_init_sessions() seems to make an effort to use this
> for another error case already, so there is likely the desire to
> distinguish the different errors here. Thus use EOPNOTSUPP as a
> replacement now, so qat_alg_aead_init_sessions() continues to return
> two different error codes depending on what went wrong.
>
> Anyway, instead of hard-coding the error codes in the function
> qat_alg_aead_init_sessions() again, let's also simply rather pass
> the error code from the called functions up to the caller instead,
> this way we can also get rid of the need to call memzero_explicit()
> here three times.
>
> Signed-off-by: Thomas Huth <thuth@xxxxxxxxxx>
> ---
> .../crypto/intel/qat/qat_common/qat_algs.c | 31 +++++++++----------
> 1 file changed, 14 insertions(+), 17 deletions(-)

Patch applied. Thanks.
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt