Skip to contentSkip to conversation

crypto: lrw - Convert to skcipher

bug report Dan Carpenter 1 participant 1 message Jan 18, 2018 Crypto API

lore
Share & tools
lore
#0 lore raw

Hello Herbert Xu,

The patch 700cb3f5fe75: "crypto: lrw - Convert to skcipher" from Nov 22, 2016, leads to the following static checker warning:

	crypto/lrw.c:316 exit_crypt()
	warn: should '(struct rctx)->ext' be freed with kzfree()'

crypto/lrw.c
309 static void exit_crypt(struct skcipher_request *req) 310 {
311 struct rctx *rctx = skcipher_request_ctx(req);
312
313 rctx->left = 0;
314
315 if (rctx->ext)

   316                  kfree(rctx->ext);
                        ^^^^^^^^^^^^^^^^

I am working on a Smatch check that complains about stuff we should maybe free with kzfree. It first makes a list of any struct members which are freed with kzfree() then it does a second pass and complains if any of them are freed with regular kfree().

317 }

Here is the complete list of warnings from v4.15-rc8. It's not very long...

crypto/lrw.c:316 exit_crypt() warn: should '(struct rctx)->ext' be freed with kzfree()' drivers/crypto/virtio/virtio_crypto_core.c:411 virtcrypto_free_unused_reqs() warn: should '(struct virtio_crypto_request)->req_data' be freed with kzfree()' drivers/net/wireless/intersil/orinoco/wext.c:78 orinoco_set_key() warn: should '(struct key_params)->key' be freed with kzfree()' drivers/staging/wlan-ng/p80211conv.c:216 skb_ether_to_p80211() warn: should '(struct p80211_metawep)->data' be freed with kzfree()' fs/cifs/connect.c:1710 cifs_parse_mount_options() warn: should '(struct smb_vol)->password' be freed with kzfree()' fs/cifs/connect.c:1748 cifs_parse_mount_options() warn: should '(struct smb_vol)->password' be freed with kzfree()' fs/cifs/connect.c:4238 cifs_construct_tcon() warn: should '(struct smb_vol)->password' be freed with kzfree()' security/apparmor/crypto.c:102 aa_calc_profile_hash() warn: should '(struct aa_profile)->hash' be freed with kzfree()'

regards,
dan carpenter