Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1271888
| From | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 2/2] keys, trusted: seal with a policy |
| Date | 2015-11-18 08:10 +0100 |
| Message-ID | <qw52p-86c-5@gated-at.bofh.it> (permalink) |
| References | <qvRiO-7og-9@gated-at.bofh.it> <qvRiO-7og-7@gated-at.bofh.it> <qvYNk-3Of-15@gated-at.bofh.it> |
| Organization | Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo |
On Wed, Nov 18, 2015 at 11:21:01AM +1100, James Morris wrote: > On Tue, 17 Nov 2015, Jarkko Sakkinen wrote: > > > } > > break; > > + case Opt_policydigest: > > + if (!tpm2 || > > + strlen(args[0].from) != (2 * opt->digest_len)) > > + return -EINVAL; > > + kfree(opt->policydigest); > > + opt->policydigest = kzalloc(opt->digest_len, > > + GFP_KERNEL); > > Is it correct to kfree opt->policydigest here before allocating it? I think so. The same option might be encountered multiple times. I don't have the check for nulliy because opt is kzalloc'd and checkpatch.pl complained that WARNING: kfree(NULL) is safe and this check is probably not required #20: FILE: security/keys/trusted.c:829: + if (opt->policydigest) + kfree(opt->policydigest); > > + if (!opt->policydigest) > > + return -ENOMEM; > > + res = hex2bin(opt->policydigest, args[0].from, > > + opt->digest_len); > > + if (res < 0) > > + return -EINVAL; > > Do you need to kfree it here on error? trusted_options_free() will kfree it. > -- > James Morris > <jmorris@namei.org> /Jarkko -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 2/2] keys, trusted: seal with a policy Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2015-11-17 17:30 +0100
Re: [PATCH 2/2] keys, trusted: seal with a policy James Morris <jmorris@namei.org> - 2015-11-18 01:30 +0100
Re: [PATCH 2/2] keys, trusted: seal with a policy Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2015-11-18 08:10 +0100
Re: [PATCH 2/2] keys, trusted: seal with a policy James Morris <jmorris@namei.org> - 2015-11-20 03:40 +0100
RE: [tpmdd-devel] [PATCH 2/2] keys, trusted: seal with a policy "Fuchs, Andreas" <andreas.fuchs@sit.fraunhofer.de> - 2015-11-19 12:10 +0100
Re: [tpmdd-devel] [PATCH 2/2] keys, trusted: seal with a policy Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2015-11-20 16:00 +0100
Re: [PATCH 2/2] keys, trusted: seal with a policy Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2015-11-21 20:00 +0100
Re: [PATCH 2/2] keys, trusted: seal with a policy Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2015-11-23 16:00 +0100
csiph-web