All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Tim Gardner <tim.gardner@canonical.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	the arch/x86 maintainers <x86@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Gleb Natapov <gleb@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	KVM list <kvm@vger.kernel.org>, Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH 3.12-rc7] KVM: Fix modprobe failure for kvm_intel/kvm_amd
Date: Wed, 30 Oct 2013 17:40:46 +0100	[thread overview]
Message-ID: <5271368E.6060802@redhat.com> (raw)
In-Reply-To: <20131030162342.GA21211@kroah.com>

Il 30/10/2013 17:23, Greg KH ha scritto:
>> > static inline struct dentry *debugfs_create_dir(const char *name,
>> >                                                 struct dentry *parent)
>> > {
>> >         return ERR_PTR(-ENODEV);
>> > }
>> > 
>> > which would oops a lot of the current callers.
> It will oops?  Really?  Where?  That shouldn't happen at all.

Doh, it obviously won't because the bogus pointer value will never be
dereferenced by the dummy debugfs_create_file.

>> > Very few places use the currently correct idiom
>> > 
>> > 	if (IS_ERR(root) || !root)
>> > 
>> > but it's very ugly...  Perhaps debugfs_create_dir *should* return an
>> > error-valued pointer after all.
> Or just don't care about the return value, and all will work out just
> fine, right?

Debugfs files would then be created in the debugfs root, which is not nice.

        /* If the parent is not specified, we create it in the root.
         * We need the root dentry to do this, which is in the super 
         * block. A pointer to that is in the struct vfsmount that we
         * have around.
         */
        if (!parent)
                parent = debugfs_mount->mnt_root;

This is all documented right:

/**
 * debugfs_create_file - create a file in the debugfs filesystem
 * ...
 * This function will return a pointer to a dentry if it succeeds.  This
 * pointer must be passed to the debugfs_remove() function when the file is
 * to be removed (no automatic cleanup happens if your module is unloaded,
 * you are responsible here.)  If an error occurs, %NULL will be returned.
 *
 * If debugfs is not enabled in the kernel, the value -%ENODEV will be
 * returned.
 */

so I guess it's just part of the API.

Paolo

  reply	other threads:[~2013-10-30 16:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-29 15:13 [PATCH 3.12-rc7] KVM: Fix modprobe failure for kvm_intel/kvm_amd Tim Gardner
2013-10-29 16:45 ` Linus Torvalds
2013-10-29 19:27   ` Raghavendra K T
2013-10-29 19:33     ` Linus Torvalds
2013-10-30 14:01       ` Raghavendra K T
2013-10-30 14:23         ` Greg KH
2013-10-30 15:39           ` Raghavendra K T
2013-10-30 15:46             ` Paolo Bonzini
2013-10-30 15:59               ` Greg KH
2013-10-30 16:08                 ` Paolo Bonzini
2013-10-30 16:23                   ` Greg KH
2013-10-30 16:40                     ` Paolo Bonzini [this message]
2013-10-29 20:00     ` Greg KH
2013-10-30 13:55       ` Raghavendra K T
2013-10-29 17:16 ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5271368E.6060802@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=gleb@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=raghavendra.kt@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=tim.gardner@canonical.com \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.