From: walter harms <wharms@bfs.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "David Airlie" <airlied@linux.ie>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Jammy Zhou" <Jammy.Zhou@amd.com>, yanyang1 <young.yang@amd.com>,
"Marek Olšák" <marek.olsak@amd.com>,
dri-devel@lists.freedesktop.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] drm/amdgpu: potential NULL dereference on error
Date: Thu, 11 Jun 2015 12:03:18 +0000 [thread overview]
Message-ID: <55797906.2090501@bfs.de> (raw)
In-Reply-To: <20150611084933.GA27393@mwanda>
Am 11.06.2015 10:49, schrieb Dan Carpenter:
> debugfs_create_file() can return an error pointer if debugfs is disabled
> or it can return NULL on error.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 36be03c..adba2a1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1980,6 +1980,8 @@ static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)
> adev, &amdgpu_debugfs_regs_fops);
> if (IS_ERR(ent))
> return PTR_ERR(ent);
> + if (!ent)
> + return -ENOMEM;
> i_size_write(ent->d_inode, adev->rmmio_size);
> adev->debugfs_regs = ent;
would PTR_ERR_OR_ZERO() by an option ?
on the other hand,
why does debugfs_create_file() does not return -ENOMEN instead of NULL ?
re,
wh
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
WARNING: multiple messages have this Message-ID (diff)
From: walter harms <wharms@bfs.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "David Airlie" <airlied@linux.ie>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Jammy Zhou" <Jammy.Zhou@amd.com>, yanyang1 <young.yang@amd.com>,
"Marek Olšák" <marek.olsak@amd.com>,
dri-devel@lists.freedesktop.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] drm/amdgpu: potential NULL dereference on error
Date: Thu, 11 Jun 2015 14:03:18 +0200 [thread overview]
Message-ID: <55797906.2090501@bfs.de> (raw)
In-Reply-To: <20150611084933.GA27393@mwanda>
Am 11.06.2015 10:49, schrieb Dan Carpenter:
> debugfs_create_file() can return an error pointer if debugfs is disabled
> or it can return NULL on error.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 36be03c..adba2a1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1980,6 +1980,8 @@ static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)
> adev, &amdgpu_debugfs_regs_fops);
> if (IS_ERR(ent))
> return PTR_ERR(ent);
> + if (!ent)
> + return -ENOMEM;
> i_size_write(ent->d_inode, adev->rmmio_size);
> adev->debugfs_regs = ent;
would PTR_ERR_OR_ZERO() by an option ?
on the other hand,
why does debugfs_create_file() does not return -ENOMEN instead of NULL ?
re,
wh
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2015-06-11 12:03 UTC|newest]
Thread overview: 10+ 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 8:49 ` Dan Carpenter
2015-06-11 12:03 ` walter harms [this message]
2015-06-11 12:03 ` walter harms
2015-06-11 12:20 ` Dan Carpenter
2015-06-11 12:20 ` Dan Carpenter
2015-06-11 14:35 ` walter harms
2015-06-11 14:35 ` walter harms
2015-06-11 14:51 ` Dan Carpenter
2015-06-11 14:51 ` Dan Carpenter
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=55797906.2090501@bfs.de \
--to=wharms@bfs.de \
--cc=Jammy.Zhou@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=christian.koenig@amd.com \
--cc=dan.carpenter@oracle.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=marek.olsak@amd.com \
--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 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.