On Thu, Oct 11, 2018 at 02:10:42PM +0300, Dan Carpenter wrote: > Hello Corentin Labbe, > > The patch cac5818c25d0: "crypto: user - Implement a generic crypto > statistics" from Sep 19, 2018, leads to the following static checker > warning: > > crypto/crypto_user_stat.c:53 crypto_report_aead() > warn: check that 'raead' doesn't leak information (struct has holes) > > crypto/crypto_user_stat.c > 34 static int crypto_report_aead(struct sk_buff *skb, struct crypto_alg *alg) > 35 { > 36 struct crypto_stat raead; > ^^^^^^^^^^^ > 37 u64 v64; > 38 u32 v32; > 39 > 40 strncpy(raead.type, "aead", sizeof(raead.type)); > 41 > 42 v32 = atomic_read(&alg->encrypt_cnt); > 43 raead.stat_encrypt_cnt = v32; > 44 v64 = atomic64_read(&alg->encrypt_tlen); > 45 raead.stat_encrypt_tlen = v64; > 46 v32 = atomic_read(&alg->decrypt_cnt); > 47 raead.stat_decrypt_cnt = v32; > 48 v64 = atomic64_read(&alg->decrypt_tlen); > 49 raead.stat_decrypt_tlen = v64; > 50 v32 = atomic_read(&alg->aead_err_cnt); > 51 raead.stat_aead_err_cnt = v32; > 52 > 53 if (nla_put(skb, CRYPTOCFGA_STAT_AEAD, > 54 sizeof(struct crypto_stat), &raead)) > ^^^^^^^^^^^^^^^^^^^^^^^^^^ > We haven't totally initialized raead and also it apparently has struct > holes after the u64s. > > 55 goto nla_put_failure; > 56 return 0; > 57 > 58 nla_put_failure: > 59 return -EMSGSIZE; > 60 } > > See also: > > crypto/crypto_user_stat.c:53 crypto_report_aead() warn: check that 'raead' doesn't leak information (struct has holes) > crypto/crypto_user_stat.c:81 crypto_report_cipher() warn: check that 'rcipher' doesn't leak information (struct has holes) > crypto/crypto_user_stat.c:108 crypto_report_comp() warn: check that 'rcomp' doesn't leak information (struct has holes) > crypto/crypto_user_stat.c:135 crypto_report_acomp() warn: check that 'racomp' doesn't leak information (struct has holes) > crypto/crypto_user_stat.c:166 crypto_report_akcipher() warn: check that 'rakcipher' doesn't leak information (struct has holes) > crypto/crypto_user_stat.c:191 crypto_report_kpp() warn: check that 'rkpp' doesn't leak information (struct has holes) > crypto/crypto_user_stat.c:215 crypto_report_ahash() warn: check that 'rhash' doesn't leak information (struct has holes) > crypto/crypto_user_stat.c:239 crypto_report_shash() warn: check that 'rhash' doesn't leak information (struct has holes) > crypto/crypto_user_stat.c:265 crypto_report_rng() warn: check that 'rrng' doesn't leak information (struct has holes) > crypto/crypto_user_stat.c:295 crypto_reportstat_one() warn: check that 'rl' doesn't leak information (struct has holes) > > regards, > dan carpenter Thanks for the report, I will send a fix soon. Regards