lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZtXBlN6nBsEUhQ4P@google.com>
Date: Mon, 2 Sep 2024 13:45:56 +0000
From: Sebastian Ene <sebastianene@...gle.com>
To: Vincent Donnefort <vdonnefort@...gle.com>
Cc: Marc Zyngier <maz@...nel.org>, akpm@...ux-foundation.org,
	alexghiti@...osinc.com, ankita@...dia.com, ardb@...nel.org,
	catalin.marinas@....com, christophe.leroy@...roup.eu,
	james.morse@....com, mark.rutland@....com, oliver.upton@...ux.dev,
	rananta@...gle.com, ryan.roberts@....com, shahuang@...hat.com,
	suzuki.poulose@....com, will@...nel.org, yuzenghui@...wei.com,
	kvmarm@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org, kernel-team@...roid.com
Subject: Re: [PATCH v9 4/5] KVM: arm64: Register ptdump with debugfs on guest
 creation

On Mon, Sep 02, 2024 at 12:13:12PM +0100, Vincent Donnefort wrote:
> [...]
> 
> > > > +static int kvm_ptdump_guest_open(struct inode *m, struct file *file)
> > > > +{
> > > > +	struct kvm *kvm = m->i_private;
> > > > +	struct kvm_ptdump_guest_state *st;
> > > > +	int ret;
> > > > +
> > > > +	if (!kvm_get_kvm_safe(kvm))
> > > > +		return -ENOENT;
> > > > +
> > > > +	st = kvm_ptdump_parser_create(kvm);
> > > > +	if (IS_ERR(st)) {
> > > > +		ret = PTR_ERR(st);
> > > > +		goto free_with_kvm_ref;
> > > > +	}
> > > > +
> > > > +	ret = single_open(file, kvm_ptdump_guest_show, st);
> > > > +	if (!ret)
> > > > +		return 0;
> > > > +
> > > > +	kfree(st);
> > > > +free_with_kvm_ref:
> > > 
> > > nit: I believe kfree understands IS_ERR() so you could have a simple "err:"
> > > label covering all the error path.
> > 
> > I couldn't find such handling in kfree(). Could you point be to it?
> 
> My aplogies, I was confused by the DEFINE_FREE(kfree ...) for __free(). kfree()
> only checks for null ptr.
> 
> Although, I wonder if the naming "free_with_kvm_ref" isn't an artifact from
> previous code? Nothing is freeed here. So perhaps err_with_kvm_ref? which could
> be shorten as this is the only label?
> 
> [...]

Yes, I guess that works better. Thanks for checking,

Seb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ