Re: [PATCH v19 13/20] ipe: add support for dm-verity as a trust provider

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu May 30, 2024 at 4:44 AM EEST, Paul Moore wrote:
> On May 24, 2024 Fan Wu <wufan@xxxxxxxxxxxxxxxxxxx> 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





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux