mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] s390/zcrypt: Fix a size determination in zcrypt_unlocked_ioctl()
@ 2020-09-22 10:30 Zhenzhong Duan
  2020-09-22 10:47 ` Christian Borntraeger
  0 siblings, 1 reply; 2+ messages in thread
From: Zhenzhong Duan @ 2020-09-22 10:30 UTC (permalink / raw)
  To: linux-kernel
  Cc: freude, hca, gor, borntraeger, schwidefsky, linux-s390, Zhenzhong Duan

With new ioctl(ZCRYPT_PERDEV_REQCNT) introduced, kernel use dynamic
allocation for the 256 element array of unsigned integers for the number
of successfully completed requests per device. It's not a static array of
64 elements any more.

Fixes: af4a72276d49 ("s390/zcrypt: Support up to 256 crypto adapters.")
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@gmail.com>
---
 drivers/s390/crypto/zcrypt_api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c
index 4dbbfd88262c..5c3f3f89e2f3 100644
--- a/drivers/s390/crypto/zcrypt_api.c
+++ b/drivers/s390/crypto/zcrypt_api.c
@@ -1449,7 +1449,7 @@ static long zcrypt_unlocked_ioctl(struct file *filp, unsigned int cmd,
 		if (!reqcnt)
 			return -ENOMEM;
 		zcrypt_perdev_reqcnt(reqcnt, AP_DEVICES);
-		if (copy_to_user((int __user *) arg, reqcnt, sizeof(reqcnt)))
+		if (copy_to_user((int __user *) arg, reqcnt, sizeof(u32) * AP_DEVICES))
 			rc = -EFAULT;
 		kfree(reqcnt);
 		return rc;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-22 10:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-22 10:30 [PATCH] s390/zcrypt: Fix a size determination in zcrypt_unlocked_ioctl() Zhenzhong Duan
2020-09-22 10:47 ` Christian Borntraeger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®