public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: walter harms <wharms@bfs.de>
Cc: "Marek Olšák" <marek.olsak@amd.com>,
	kernel-janitors@vger.kernel.org, dri-devel@lists.freedesktop.org,
	yanyang1 <young.yang@amd.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>
Subject: Re: [patch] drm/amdgpu: potential NULL dereference on error
Date: Thu, 11 Jun 2015 14:51:22 +0000	[thread overview]
Message-ID: <20150611145121.GB30834@mwanda> (raw)
In-Reply-To: <55799CAE.4070809@bfs.de>

On Thu, Jun 11, 2015 at 04:35:26PM +0200, walter harms wrote:
> You still have to check 2 types of error return here.
> I simply do not understand why ebugfs_create_file() does not return -ENOMEM
> (or returns NULL on any error).

To be honest, I don't know why debugfs_create_file() doesn't just return
NULL when it is configured out.  I think I have asked this before...

I think the answer is that it seemed like a good idea at the time.
These days we would probably prefer to use:

	if (enabled(CONFIG_DEBUGFS)) {

to test if it's there or not.  Maybe that's still the right thing to
check here.

But debugfs error handling is designed so that under normal situations
you don't have to check for errors.  It turns out that everyone still
does because they are used to checking for errors.

The only reason we have to check here is because we do:

	i_size_write(ent->d_inode, adev->rmmio_size);
                     ^^^^^^^^^^^^

Dereference.

regards,
dan carpenter


      reply	other threads:[~2015-06-11 14:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-11  8:49 [patch] drm/amdgpu: potential NULL dereference on error Dan Carpenter
2015-06-11 12:03 ` walter harms
2015-06-11 12:20   ` Dan Carpenter
2015-06-11 14:35     ` walter harms
2015-06-11 14:51       ` Dan Carpenter [this message]

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=20150611145121.GB30834@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=alexander.deucher@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=marek.olsak@amd.com \
    --cc=wharms@bfs.de \
    --cc=young.yang@amd.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox