mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Harald Freudenberger <freude@linux.ibm.com>
To: Arnd Bergmann <arnd@arndb.de>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: clang-built-linux@googlegroups.com,
	Nick Desaulniers <ndesaulniers@google.com>,
	Nathan Chancellor <natechancellor@gmail.com>,
	linux-s390@vger.kernel.org, Ingo Franzki <ifranzki@de.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 05/12] s390: zcrypt: initialize variables before_use
Date: Tue, 9 Apr 2019 11:54:30 +0200	[thread overview]
Message-ID: <8875e0b6-00b4-884d-fd6a-a5a144543559@linux.ibm.com> (raw)
In-Reply-To: <20190408212648.2407234-5-arnd@arndb.de>

On 08.04.19 23:26, Arnd Bergmann wrote:
> The 'func_code' variable gets printed in debug statements without
> a prior initialization in multiple functions, as reported when building
> with clang:
>
> drivers/s390/crypto/zcrypt_api.c:659:6: warning: variable 'func_code' is used uninitialized whenever 'if' condition is true
>       [-Wsometimes-uninitialized]
>         if (mex->outputdatalength < mex->inputdatalength) {
>             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/s390/crypto/zcrypt_api.c:725:29: note: uninitialized use occurs here
>         trace_s390_zcrypt_rep(mex, func_code, rc,
>                                    ^~~~~~~~~
> drivers/s390/crypto/zcrypt_api.c:659:2: note: remove the 'if' if its condition is always false
>         if (mex->outputdatalength < mex->inputdatalength) {
>         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/s390/crypto/zcrypt_api.c:654:24: note: initialize the variable 'func_code' to silence this warning
>         unsigned int func_code;
>                               ^
>
> Add initializations to all affected code paths to shut up the warning
> and make the warning output consistent.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/s390/crypto/zcrypt_api.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c
> index eb93c2d27d0a..23472063d9a8 100644
> --- a/drivers/s390/crypto/zcrypt_api.c
> +++ b/drivers/s390/crypto/zcrypt_api.c
> @@ -657,6 +657,7 @@ static long zcrypt_rsa_modexpo(struct ap_perms *perms,
>  	trace_s390_zcrypt_req(mex, TP_ICARSAMODEXPO);
>  
>  	if (mex->outputdatalength < mex->inputdatalength) {
> +		func_code = -1;
>  		rc = -EINVAL;
>  		goto out;
>  	}
> @@ -739,6 +740,7 @@ static long zcrypt_rsa_crt(struct ap_perms *perms,
>  	trace_s390_zcrypt_req(crt, TP_ICARSACRT);
>  
>  	if (crt->outputdatalength < crt->inputdatalength) {
> +		func_code = -1;
>  		rc = -EINVAL;
>  		goto out;
>  	}
> @@ -946,6 +948,7 @@ static long zcrypt_send_ep11_cprb(struct ap_perms *perms,
>  
>  		targets = kcalloc(target_num, sizeof(*targets), GFP_KERNEL);
>  		if (!targets) {
> +			func_code = -1;
>  			rc = -ENOMEM;
>  			goto out;
>  		}
> @@ -953,6 +956,7 @@ static long zcrypt_send_ep11_cprb(struct ap_perms *perms,
>  		uptr = (struct ep11_target_dev __force __user *) xcrb->targets;
>  		if (copy_from_user(targets, uptr,
>  				   target_num * sizeof(*targets))) {
> +			func_code = -1;
>  			rc = -EFAULT;
>  			goto out_free;
>  		}
Thanks Arnd, but as Nathan already wrote, I'd prefer to have the
variable initialized with 0 instead of -1.
If you agree with this, I'll rewrite the patch and apply it to our
internal git and it will appear at kernel org with the next s390 code merge then.
regards Harald Freudenberger


  parent reply	other threads:[~2019-04-09  9:54 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-08 21:26 [PATCH 01/12] s390: remove -fno-strength-reduce flag Arnd Bergmann
2019-04-08 21:26 ` [PATCH 02/12] s390: don't build vdso32 with clang Arnd Bergmann
2019-04-10 15:57   ` Martin Schwidefsky
2019-04-10 16:26   ` Nick Desaulniers
2019-04-10 19:00     ` Arnd Bergmann
2019-04-08 21:26 ` [PATCH 03/12] s390: purgatory: pass --target option to clang Arnd Bergmann
2019-04-08 22:03   ` Nathan Chancellor
2019-04-09  6:43     ` Arnd Bergmann
2019-04-09 16:30       ` Nathan Chancellor
2019-04-09 18:11         ` Nick Desaulniers
2019-04-08 21:26 ` [PATCH 04/12] s390: qeth: address type mismatch warning Arnd Bergmann
2019-04-08 22:16   ` Nathan Chancellor
2019-04-09  6:44     ` Arnd Bergmann
2019-04-10 15:58   ` Martin Schwidefsky
2019-04-08 21:26 ` [PATCH 05/12] s390: zcrypt: initialize variables before_use Arnd Bergmann
2019-04-08 22:31   ` Nathan Chancellor
2019-04-09  9:54   ` Harald Freudenberger [this message]
2019-04-09 10:13     ` Arnd Bergmann
2019-04-10 15:59     ` Martin Schwidefsky
2019-04-10 18:57       ` Arnd Bergmann
2019-04-11  7:40         ` Martin Schwidefsky
2019-04-08 21:26 ` [PATCH 06/12] s390: ctcm: fix ctcm_new_device error return code Arnd Bergmann
2019-04-08 22:33   ` Nathan Chancellor
2019-04-10 16:00   ` Martin Schwidefsky
2019-04-08 21:26 ` [PATCH 07/12] s390: cio: fix cio_irb declaration Arnd Bergmann
2019-04-08 22:35   ` Nathan Chancellor
2019-04-09 13:13   ` Sebastian Ott
2019-04-08 21:26 ` [PATCH 08/12] s390: syscall_wrapper: avoid clang warning Arnd Bergmann
2019-04-10 16:00   ` Martin Schwidefsky
2019-04-08 21:26 ` [PATCH 09/12] s390: make __load_psw_mask work with clang Arnd Bergmann
2019-04-10 16:01   ` Martin Schwidefsky
2019-04-08 21:26 ` [PATCH 10/12] s390: avoid __builtin_return_address(n) on clang Arnd Bergmann
2019-04-10 16:03   ` Martin Schwidefsky
2019-04-10 16:14     ` Steven Rostedt
2019-04-10 19:07       ` Arnd Bergmann
2019-04-11  7:32         ` Martin Schwidefsky
2019-04-08 21:26 ` [PATCH 11/12] s390: make chkbss work with clang Arnd Bergmann
2019-04-10 16:02   ` Martin Schwidefsky
2019-04-08 21:26 ` [PATCH 12/12] [PROBABLY WRONG] s390: void '0' constraint in inline assembly Arnd Bergmann
2019-04-10 13:55   ` Martin Schwidefsky
2019-04-10 16:35     ` Nick Desaulniers
2019-04-10 18:55     ` Arnd Bergmann
2019-04-10 15:57 ` [PATCH 01/12] s390: remove -fno-strength-reduce flag Martin Schwidefsky

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=8875e0b6-00b4-884d-fd6a-a5a144543559@linux.ibm.com \
    --to=freude@linux.ibm.com \
    --cc=arnd@arndb.de \
    --cc=clang-built-linux@googlegroups.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=ifranzki@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=natechancellor@gmail.com \
    --cc=ndesaulniers@google.com \
    --cc=schwidefsky@de.ibm.com \
    /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

all inboxes | Powered by JetHome®