From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752439AbdHIFxH (ORCPT ); Wed, 9 Aug 2017 01:53:07 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:50896 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752322AbdHIFxF (ORCPT ); Wed, 9 Aug 2017 01:53:05 -0400 Date: Wed, 9 Aug 2017 07:52:58 +0200 From: Heiko Carstens To: Bhumika Goyal Cc: julia.lawall@lip6.fr, freude@de.ibm.com, schwidefsky@de.ibm.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] s390/crypto: make cca_public_sec and cca_token_hdr const References: <1501998747-4094-1-git-send-email-bhumirks@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1501998747-4094-1-git-send-email-bhumirks@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 17080905-0008-0000-0000-0000048B71AA X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17080905-0009-0000-0000-00001E1A9B28 Message-Id: <20170809055257.GA4583@osiris> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-08-09_01:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1708090091 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 06, 2017 at 11:22:27AM +0530, Bhumika Goyal wrote: > Declare cca_public_sec and cca_token_hdr structures as const as they are > only used during copy operations. > > Signed-off-by: Bhumika Goyal > --- > drivers/s390/crypto/zcrypt_cca_key.h | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/s390/crypto/zcrypt_cca_key.h b/drivers/s390/crypto/zcrypt_cca_key.h > index 12cff62..7b78ba6 100644 > --- a/drivers/s390/crypto/zcrypt_cca_key.h > +++ b/drivers/s390/crypto/zcrypt_cca_key.h > @@ -116,10 +116,10 @@ struct cca_pvt_ext_CRT_sec { > */ > static inline int zcrypt_type6_mex_key_en(struct ica_rsa_modexpo *mex, void *p) > { > - static struct cca_token_hdr static_pub_hdr = { > + static const struct cca_token_hdr static_pub_hdr = { > .token_identifier = 0x1E, > }; > - static struct cca_public_sec static_pub_sec = { > + static const struct cca_public_sec static_pub_sec = { > .section_identifier = 0x04, > }; > struct { > @@ -176,7 +176,7 @@ static inline int zcrypt_type6_mex_key_en(struct ica_rsa_modexpo *mex, void *p) > */ > static inline int zcrypt_type6_crt_key(struct ica_rsa_modexpo_crt *crt, void *p) > { > - static struct cca_public_sec static_cca_pub_sec = { > + static const struct cca_public_sec static_cca_pub_sec = { > .section_identifier = 4, > .section_length = 0x000f, > .exponent_len = 0x0003, If you look at the code, it seems to be questionable why these structures are declared static and not simply on the stack. In the first case we are talking of an assignment of two single bytes two a structure that has already been zeroed. Besides this, the two functions in the header file are very large and shouldn't be unconditionally inlined anyway. This needs to be cleaned up. So I'm not at all in favor of a patch that just adds a const keyword in addition.