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





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux