kexec: kexec_crash_save_info() vs Misra C:2012 rule 8.3
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Andrew Cooper
Acked-byQuoted 7 lines · Jan Beulich
... ("All declarations of an object or function shall use the same names and type qualifiers"). The declaration doesn't use the typedef, so the definition shouldn't either.
Signed-off-by Jan Beulich <[email protected]>---
Really, is the typedef of much use? I.e. can't we drop it altogether?
It doesn't look to be much use.
I thought I'd tried this fix before but it hadn't worked. (I dropped it from my series as a result). Perhaps the later include shuffling addressed the secondary issue I was seeing.
Stefano Stabellini
Reviewed-byQuoted 5 lines · Jan Beulich
... ("All declarations of an object or function shall use the same names and type qualifiers"). The declaration doesn't use the typedef, so the definition shouldn't either.
Signed-off-by Jan Beulich <[email protected]>
Quoted 16 lines
---
Really, is the typedef of much use? I.e. can't we drop it altogether?xen/common/kexec.c +1
-1@@ -333,7 +333,7 @@ void kexec_crash_save_cpu(void) }/* Set up the single Xen-specific-info crash note. */ -crash_xen_info_t *kexec_crash_save_info (void ) +struct crash_xen_info *kexec_crash_save_info (void ) {int cpu =smp_processor_id ();crash_xen_info_t info;
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 2/2] crypto/rijndael: adjust for Misra C:2012 rule 8.3
Quoted 10 lines · Jan Beulich
... ("All declarations of an object or function shall use the same names and type qualifiers"). Bring declarations in line with the corresponding definitions, accepting the use of the being-phased-out u<N> types. While we don't define
NEED_RIJNDAEL_DECRYPT, coverrijndaelKeySetupDec()as well for completeness.Signed-off-by Jan Beulich <[email protected]>
xen/include/crypto/rijndael.h int rijndael_set_key_enc_only(rijndael_c · line 54
Quoted 9 lines
xen/include/crypto/rijndael.h +2
-4@@ -50,9 +50,8 @@ int rijndael_set_key_enc_only(rijndael_cvoid rijndael_decrypt (rijndael_ctx *ctx,const unsigned char *src,unsigned char *dst);void rijndael_encrypt (rijndael_ctx *ctx,const unsigned char *src,unsigned char *dst); -int rijndaelKeySetupEnc (unsigned int rk[],const unsigned char cipherKey[],int keyBits); -int rijndaelKeySetupDec (unsigned int rk[],const unsigned char cipkerKey[],int keyBits); -void rijndaelEncrypt (const unsigned int rk[],int Nr,const unsigned char pt[16 ], -unsigned char ct[16 ]); +int rijndaelKeySetupEnc (u32 rk[],const u8 cipherKey[],int keyBits); +int rijndaelKeySetupDec (u32 rk[],const u8 cipkerKey[],int keyBits);
There is a typo "cipkerKey" which is only present in rijndael.h but not in rijndael.c
Quoted 5 lines
xen/include/crypto/rijndael.h +1
-0+void rijndaelEncrypt (const u32 rk[],int Nr,const u8 pt[16 ],u8 ct[16 ]);#endif /* __RIJNDAEL_H */
Nicola Vetrini
Reviewed-byRe: [PATCH 2/2] crypto/rijndael: adjust for Misra C:2012 rule 8.3
In reply to a message not in the archiveQuoted 8 lines · Jan Beulich
... ("All declarations of an object or function shall use the same names and type qualifiers"). Bring declarations in line with the corresponding definitions, accepting the use of the being-phased-out u<N> types. While we don't define
NEED_RIJNDAEL_DECRYPT, coverrijndaelKeySetupDec()as well for completeness.Signed-off-by Jan Beulich <[email protected]>
with the typo in rijndaelKeySetupDec's declaration fixed as noted by Stefano
Quoted 21 lines
xen/include/crypto/rijndael.h +0
-3@@ -50,9 +50,8 @@ int rijndael_set_key_enc_only(rijndael_cvoid rijndael_decrypt (rijndael_ctx *ctx,const unsigned char *src,unsigned char *dst);void rijndael_encrypt (rijndael_ctx *ctx,const unsigned char *src,unsigned char *dst); -int rijndaelKeySetupEnc (unsigned int rk[],const unsigned char cipherKey[], int keyBits); -int rijndaelKeySetupDec (unsigned int rk[],const unsigned char cipkerKey[], int keyBits); -void rijndaelEncrypt(const unsigned int rk[], int Nr, const unsignedchar pt[16],
xen/include/crypto/rijndael.h +3
-1- unsigned char ct[16]); +int rijndaelKeySetupEnc (u32 rk[],const u8 cipherKey[],int keyBits); +int rijndaelKeySetupDec (u32 rk[],const u8 cipkerKey[],int keyBits); +void rijndaelEncrypt(const u32 rk[], int Nr, const u8 pt[16], u8ct[16]);
#endif /*
__RIJNDAEL_H*/
Signature · 4 lines
Nicola Vetrini, B.Sc. Software Engineer BUGSENG (https://bugseng.com) LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253
Re: [PATCH 2/2] crypto/rijndael: adjust for Misra C:2012 rule 8.3
In reply to a message not in the archiveQuoted 14 lines · Jan Beulich
... ("All declarations of an object or function shall use the same names and type qualifiers"). Bring declarations in line with the corresponding definitions, accepting the use of the being-phased-out u<N> types. While we don't define
NEED_RIJNDAEL_DECRYPT, coverrijndaelKeySetupDec()as well for completeness.Signed-off-by Jan Beulich <[email protected]>xen/include/crypto/rijndael.h +0
-0@@ -50,9 +50,8 @@ int rijndael_set_key_enc_only(rijndael_cvoid rijndael_decrypt (rijndael_ctx *ctx,const unsigned char *src,unsigned char *dst);void rijndael_encrypt (rijndael_ctx *ctx,const unsigned char *src,unsigned char *dst);
xen/include/crypto/rijndael.h int rijndael_set_key_enc_only(rijndael_c · line 57
Quoted 10 lines
xen/include/crypto/rijndael.h +3
-4-int rijndaelKeySetupEnc (unsigned int rk[],const unsigned char cipherKey[],int keyBits); -int rijndaelKeySetupDec (unsigned int rk[],const unsigned char cipkerKey[],int keyBits); -void rijndaelEncrypt (const unsigned int rk[],int Nr,const unsigned char pt[16 ], -unsigned char ct[16 ]); +int rijndaelKeySetupEnc (u32 rk[],const u8 cipherKey[],int keyBits); +int rijndaelKeySetupDec (u32 rk[],const u8 cipkerKey[],int keyBits); +void rijndaelEncrypt (const u32 rk[],int Nr,const u8 pt[16 ],u8 ct[16 ]);#endif /* __RIJNDAEL_H */
Hmm.
The rijndael_encrypt() in context is a trivial wrapper of rijndaelEncrypt() using rijndael_ctx. The only user is VMAC which defines aes_encryption() in terms of rijndaelEncrypt(), making rijndael_encrypt() dead code. The decrypt side is even deader code.
It might be worth taking this patch in the short term, but I think we could get away with a lot of deletion.
~Andrew
Re: [PATCH 2/2] crypto/rijndael: adjust for Misra C:2012 rule 8.3
Quoted 28 lines · Andrew Cooper
Quoted 14 lines · Jan Beulich
... ("All declarations of an object or function shall use the same names and type qualifiers"). Bring declarations in line with the corresponding definitions, accepting the use of the being-phased-out u<N> types. While we don't define
NEED_RIJNDAEL_DECRYPT, coverrijndaelKeySetupDec()as well for completeness.Signed-off-by Jan Beulich <[email protected]>xen/include/crypto/rijndael.h +0
-0@@ -50,9 +50,8 @@ int rijndael_set_key_enc_only(rijndael_cvoid rijndael_decrypt (rijndael_ctx *ctx,const unsigned char *src,unsigned char *dst);void rijndael_encrypt (rijndael_ctx *ctx,const unsigned char *src,unsigned char *dst);xen/include/crypto/rijndael.h int rijndael_set_key_enc_only(rijndael_c · line 57
Quoted 10 lines
xen/include/crypto/rijndael.h +3
-4-int rijndaelKeySetupEnc (unsigned int rk[],const unsigned char cipherKey[],int keyBits); -int rijndaelKeySetupDec (unsigned int rk[],const unsigned char cipkerKey[],int keyBits); -void rijndaelEncrypt (const unsigned int rk[],int Nr,const unsigned char pt[16 ], -unsigned char ct[16 ]); +int rijndaelKeySetupEnc (u32 rk[],const u8 cipherKey[],int keyBits); +int rijndaelKeySetupDec (u32 rk[],const u8 cipkerKey[],int keyBits); +void rijndaelEncrypt (const u32 rk[],int Nr,const u8 pt[16 ],u8 ct[16 ]);#endif /* __RIJNDAEL_H */ Hmm.
Quoted 7 lines
The
rijndael_encrypt()in context is a trivial wrapper ofrijndaelEncrypt()using rijndael_ctx. The only user is VMAC which definesaes_encryption()in terms ofrijndaelEncrypt(), makingrijndael_encrypt()dead code. The decrypt side is even deader code.It might be worth taking this patch in the short term, but I think we could get away with a lot of deletion.
Well, really this whole piece of code would likely better be replaced by something structured, assuming it's going to be needed at all anymore after TBOOT deletion.
Jan