public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: Harald Freudenberger <freude@linux.ibm.com>
Cc: dengler@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com,
	linux-s390@vger.kernel.org, herbert@gondor.apana.org.au,
	ifranzki@linux.ibm.com, fcallies@linux.ibm.com
Subject: Re: [PATCH v7 02/25] s390/ap/zcrypt: Rework AP message buffer allocation
Date: Thu, 24 Apr 2025 08:45:36 +0200	[thread overview]
Message-ID: <20250424064536.7083A9a-hca@linux.ibm.com> (raw)
In-Reply-To: <20250423101535.143137-3-freude@linux.ibm.com>

On Wed, Apr 23, 2025 at 12:15:11PM +0200, Harald Freudenberger wrote:
> Slight rework on the way how AP message buffers are allocated.
> Instead of having multiple places with kmalloc() calls all
> the AP message buffers are now allocated and freed on exactly
> one place: ap_init_apmsg() allocates the current AP bus max
> limit of ap_max_msg_size (defaults to 12KB). The AP message
> buffer is then freed in ap_release_apmsg().
> 
> Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
> Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
> ---
>  drivers/s390/crypto/ap_bus.c           | 26 ++++++++++++++
>  drivers/s390/crypto/ap_bus.h           | 21 ++---------
>  drivers/s390/crypto/zcrypt_api.c       | 49 +++++++++++++++-----------
>  drivers/s390/crypto/zcrypt_msgtype50.c | 20 ++++++-----
>  drivers/s390/crypto/zcrypt_msgtype6.c  | 35 +++++++++---------
>  5 files changed, 86 insertions(+), 65 deletions(-)

...

> diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c
> index 5020696f1379..78df25da0b95 100644
> --- a/drivers/s390/crypto/zcrypt_api.c
> +++ b/drivers/s390/crypto/zcrypt_api.c
> @@ -642,16 +642,17 @@ static long zcrypt_rsa_modexpo(struct ap_perms *perms,
>  	struct zcrypt_queue *zq, *pref_zq;
>  	struct ap_message ap_msg;
>  	unsigned int wgt = 0, pref_wgt = 0;
> -	unsigned int func_code;
> -	int cpen, qpen, qid = 0, rc = -ENODEV;
> +	unsigned int func_code = 0;
> +	int cpen, qpen, qid = 0, rc;
>  	struct module *mod;
>  
>  	trace_s390_zcrypt_req(mex, TP_ICARSAMODEXPO);
>  
> -	ap_init_message(&ap_msg);
> +	rc = ap_init_apmsg(&ap_msg);
> +	if (rc)
> +		goto out;

clang says:

    CC [M]  drivers/s390/crypto/zcrypt_api.o
      drivers/s390/crypto/zcrypt_api.c:1223:6: warning: variable 'func_code' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
       1223 |         if (rc)
            |             ^~
      drivers/s390/crypto/zcrypt_api.c:1271:32: note: uninitialized use occurs here
       1271 |         trace_s390_zcrypt_rep(buffer, func_code, rc,
            |                                       ^~~~~~~~~
      drivers/s390/crypto/zcrypt_api.c:1223:2: note: remove the 'if' if its condition is always false
       1223 |         if (rc)
            |         ^~~~~~~
       1224 |                 goto out;
            |                 ~~~~~~~~
      drivers/s390/crypto/zcrypt_api.c:1214:24: note: initialize the variable 'func_code' to silence this warning
       1214 |         unsigned int func_code;
            |                               ^
            |                                = 0

Actually the problem that func_code may be used uninitialized existed before
your patch series, but now at least clang can prove it and complains.

  reply	other threads:[~2025-04-24  6:45 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-23 10:15 [PATCH v7 00/25] AP bus/zcrypt/pkey/paes no-mem-alloc patches Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 01/25] s390/ap: Move response_type struct into ap_msg struct Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 02/25] s390/ap/zcrypt: Rework AP message buffer allocation Harald Freudenberger
2025-04-24  6:45   ` Heiko Carstens [this message]
2025-04-23 10:15 ` [PATCH v7 03/25] s390/ap: Introduce ap message buffer pool Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 04/25] s390/zcrypt: Avoid alloc and copy of ep11 targets if kernelspace cprb Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 05/25] s390/ap/zcrypt: New xflag parameter Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 06/25] s390/zcrypt: Introduce cprb mempool for cca misc functions Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 07/25] s390/zcrypt: Introduce cprb mempool for ep11 " Harald Freudenberger
2025-04-24  6:58   ` Heiko Carstens
2025-04-23 10:15 ` [PATCH v7 08/25] s390/zcrypt: Rework zcrypt function zcrypt_device_status_mask_ext Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 09/25] s390/zcrypt: Introduce pre-allocated device status array for cca misc Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 10/25] s390/zcrypt: Introduce pre-allocated device status array for ep11 misc Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 11/25] s390/zcrypt: Remove unused functions from cca misc Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 12/25] s390/zcrypt: Remove CCA and EP11 card and domain info caches Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 13/25] s390/zcrypt: Rework cca findcard() implementation and callers Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 14/25] s390/zcrypt: Rework ep11 " Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 15/25] s390/zcrypt: Rework cca misc functions kmallocs to use the cprb mempool Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 16/25] s390/zcrypt: Propagate xflags argument with cca_get_info() Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 17/25] s390/zcrypt: Locate ep11_domain_query_info onto the stack instead of kmalloc Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 18/25] s390/zcrypt: Rework ep11 misc functions to use cprb mempool Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 19/25] s390/pkey: Rework CCA pkey handler to use stack for small memory allocs Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 20/25] s390/pkey: Rework EP11 " Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 21/25] s390/uv: Rename find_secret() to uv_find_secret() and publish Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 22/25] s390/pkey: Use preallocated memory for retrieve of UV secret metadata Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 23/25] s390/uv: Remove uv_get_secret_metadata function Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 24/25] s390/pkey: Provide and pass xflags within pkey and zcrypt layers Harald Freudenberger
2025-04-23 10:15 ` [PATCH v7 25/25] s390/pkey/crypto: Introduce xflags param for pkey in-kernel API Harald Freudenberger
2025-04-23 10:40 ` [PATCH v7 00/25] AP bus/zcrypt/pkey/paes no-mem-alloc patches Heiko Carstens
2025-04-23 15:07   ` Harald Freudenberger
2025-04-23 15:15     ` Heiko Carstens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250424064536.7083A9a-hca@linux.ibm.com \
    --to=hca@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=dengler@linux.ibm.com \
    --cc=fcallies@linux.ibm.com \
    --cc=freude@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=ifranzki@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox