]> Gentwo Git Trees - linux/.git/commit
crypto: qat - Replace kzalloc() + copy_from_user() with memdup_user()
authorThorsten Blum <thorsten.blum@linux.dev>
Fri, 5 Sep 2025 16:39:11 +0000 (18:39 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 13 Sep 2025 04:11:06 +0000 (12:11 +0800)
commit1e26339703e2afd397037defa798682b2b93dcc0
tree9c84504a38713898ff5fca45d01eddc43d307f23
parent9048beca9c5614d486e2b492c0a7867164bf56a8
crypto: qat - Replace kzalloc() + copy_from_user() with memdup_user()

Replace kzalloc() followed by copy_from_user() with memdup_user() to
improve and simplify adf_ctl_alloc_resources(). memdup_user() returns
either -ENOMEM or -EFAULT (instead of -EIO) if an error occurs.

Remove the unnecessary device id initialization, since memdup_user()
(like copy_from_user()) immediately overwrites it.

No functional changes intended other than returning the more idiomatic
error code -EFAULT.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/intel/qat/qat_common/adf_ctl_drv.c