[PATCH v19 13/20] ipe: add support for dm-verity as a trust provider
Jarkko Sakkinen
jarkko at kernel.org
Thu May 30 05:49:43 UTC 2024
On Thu May 30, 2024 at 4:44 AM EEST, Paul Moore wrote:
> On May 24, 2024 Fan Wu <wufan at linux.microsoft.com> wrote:
> > + if (type == LSM_INT_DMVERITY_ROOTHASH) {
> > + if (!value) {
> > + ipe_digest_free(blob->root_hash);
> > + blob->root_hash = NULL;
> > +
> > + return 0;
> > + }
> > + digest = value;
> > +
> > + info = kzalloc(sizeof(*info), GFP_KERNEL);
> > + if (!info)
> > + return -ENOMEM;
> > +
> > + info->digest = kmemdup(digest->digest, digest->digest_len,
> > + GFP_KERNEL);
> > + if (!info->digest)
> > + goto dmv_roothash_err;
> > +
> > + info->alg = kstrdup(digest->alg, GFP_KERNEL);
> > + if (!info->alg)
> > + goto dmv_roothash_err;
> > +
> > + info->digest_len = digest->digest_len;
> > +
> > + if (blob->root_hash)
> > + ipe_digest_free(blob->root_hash);
I'd restructure this as:
if (type == LSM_INT_DMVERITY_SIG_VALID {
/* ... */
return 0;
}
if (type != LSM_INT_DMVERITY_ROOTHASH)
return -EINVAL;
* ... */
Right? Less packed to the right ;-)
BR, Jarkko
More information about the Linux-security-module-archive
mailing list