Re: [patch] drm/amdgpu: potential NULL dereference on error

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

 



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

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux