* [patch] xfs: fix an error code in xfs_fs_fill_super()
@ 2015-10-15 18:19 Dan Carpenter
2015-10-15 18:48 ` Bill O'Donnell
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-10-15 18:19 UTC (permalink / raw)
To: Dave Chinner, Bill O'Donnell; +Cc: kernel-janitors, xfs
If alloc_percpu() fails, we accidentally return PTR_ERR(NULL), which
means success, but we intended to return -ENOMEM.
Fixes: 225e4635580c ('xfs: per-filesystem stats in sysfs')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 368c55a..b2c252c 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1477,7 +1477,7 @@ xfs_fs_fill_super(
/* Allocate stats memory before we do operations that might use it */
mp->m_stats.xs_stats = alloc_percpu(struct xfsstats);
if (!mp->m_stats.xs_stats) {
- error = PTR_ERR(mp->m_stats.xs_stats);
+ error = -ENOMEM;
goto out_destroy_counters;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] xfs: fix an error code in xfs_fs_fill_super()
2015-10-15 18:19 [patch] xfs: fix an error code in xfs_fs_fill_super() Dan Carpenter
@ 2015-10-15 18:48 ` Bill O'Donnell
0 siblings, 0 replies; 2+ messages in thread
From: Bill O'Donnell @ 2015-10-15 18:48 UTC (permalink / raw)
To: Dan Carpenter; +Cc: kernel-janitors, xfs
On Thu, Oct 15, 2015 at 09:19:51PM +0300, Dan Carpenter wrote:
> If alloc_percpu() fails, we accidentally return PTR_ERR(NULL), which
> means success, but we intended to return -ENOMEM.
>
> Fixes: 225e4635580c ('xfs: per-filesystem stats in sysfs')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index 368c55a..b2c252c 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -1477,7 +1477,7 @@ xfs_fs_fill_super(
> /* Allocate stats memory before we do operations that might use it */
> mp->m_stats.xs_stats = alloc_percpu(struct xfsstats);
> if (!mp->m_stats.xs_stats) {
> - error = PTR_ERR(mp->m_stats.xs_stats);
> + error = -ENOMEM;
> goto out_destroy_counters;
> }
>
Agreed. Thanks for the patch.
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-15 18:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-15 18:19 [patch] xfs: fix an error code in xfs_fs_fill_super() Dan Carpenter
2015-10-15 18:48 ` Bill O'Donnell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).