On Thu May 30, 2024 at 4:44 AM EEST, Paul Moore wrote:
> On May 24, 2024 Fan Wu <[email protected]> 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

Reply via email to