Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1271765

Re: [PATCH 2/2] keys, trusted: seal with a policy

From James Morris <jmorris@namei.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] keys, trusted: seal with a policy
Date 2015-11-18 01:30 +0100
Message-ID <qvYNk-3Of-15@gated-at.bofh.it> (permalink)
References <qvRiO-7og-9@gated-at.bofh.it> <qvRiO-7og-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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?


> +			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?

-- 
James Morris
<jmorris@namei.org>

--
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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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