summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorThomas Richter <tmricht@linux.ibm.com>2024-01-18 13:24:45 +0100
committerHeiko Carstens <hca@linux.ibm.com>2024-02-09 13:58:13 +0100
commit3a5da4670dfad43e8e0b0c7135409c1f70230797 (patch)
tree711bf3cd101ba2841bc0965f7073c7296cb063bc /arch
parents390/pai: fix attr_event_free upper limit for pai device drivers (diff)
downloadlinux-3a5da4670dfad43e8e0b0c7135409c1f70230797.tar.xz
linux-3a5da4670dfad43e8e0b0c7135409c1f70230797.zip
s390/pai_crypto: emit error on too many counters
When the device driver is initialized, it checks the number of possible counters. Should this number be too high, emit an error and return. Reported-by: Sumanth Korikkar <sumanthk@linux.ibm.com> Signed-off-by: Thomas Richter <tmricht@linux.ibm.com> Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/s390/kernel/perf_pai_crypto.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/s390/kernel/perf_pai_crypto.c b/arch/s390/kernel/perf_pai_crypto.c
index 522a5ea0a9f4..69639ff1c5e0 100644
--- a/arch/s390/kernel/perf_pai_crypto.c
+++ b/arch/s390/kernel/perf_pai_crypto.c
@@ -742,8 +742,10 @@ static int __init paicrypt_init(void)
paicrypt_cnt = ib.num_cc;
if (paicrypt_cnt == 0)
return 0;
- if (paicrypt_cnt >= PAI_CRYPTO_MAXCTR)
- paicrypt_cnt = PAI_CRYPTO_MAXCTR - 1;
+ if (paicrypt_cnt >= PAI_CRYPTO_MAXCTR) {
+ pr_err("Too many PMU pai_crypto counters %d\n", paicrypt_cnt);
+ return -1;
+ }
rc = attr_event_init(); /* Export known PAI crypto events */
if (rc) {