[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <D1MQS61J31B4.26M79HHP1VCQT@kernel.org>
Date: Thu, 30 May 2024 08:49:43 +0300
From: "Jarkko Sakkinen" <jarkko@...nel.org>
To: "Paul Moore" <paul@...l-moore.com>, "Fan Wu"
<wufan@...ux.microsoft.com>, <corbet@....net>, <zohar@...ux.ibm.com>,
<jmorris@...ei.org>, <serge@...lyn.com>, <tytso@....edu>,
<ebiggers@...nel.org>, <axboe@...nel.dk>, <agk@...hat.com>,
<snitzer@...nel.org>, <mpatocka@...hat.com>, <eparis@...hat.com>
Cc: <linux-doc@...r.kernel.org>, <linux-integrity@...r.kernel.org>,
<linux-security-module@...r.kernel.org>, <fsverity@...ts.linux.dev>,
<linux-block@...r.kernel.org>, <dm-devel@...ts.linux.dev>,
<audit@...r.kernel.org>, <linux-kernel@...r.kernel.org>, "Deven Bowers"
<deven.desai@...ux.microsoft.com>
Subject: Re: [PATCH v19 13/20] ipe: add support for dm-verity as a trust
provider
On Thu May 30, 2024 at 4:44 AM EEST, Paul Moore wrote:
> On May 24, 2024 Fan Wu <wufan@...ux.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
Powered by blists - more mailing lists