aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2008-05-20 01:10:44 -0400
committerNiv Sardi <xaiki@debian.org>2008-07-28 02:58:27 -0400
commitbdd907bab78419f34113c51470192945741b839e (patch)
tree411366f18ded6458d0d087012aef17886bbf1106
parente34b562c6bbffc3c466251ffa1d2adaf163db566 (diff)
[XFS] allow xfs_args_allocate to fail
Switch xfs_args_allocate to kzalloc and handle failures. SGI-PV: 981951 SGI-Modid: xfs-linux-melb:xfs-kern:31195a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: David Chinner <dgc@sgi.com> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 613370f9a4bd..d13d883d0039 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -75,7 +75,10 @@ xfs_args_allocate(
75{ 75{
76 struct xfs_mount_args *args; 76 struct xfs_mount_args *args;
77 77
78 args = kmem_zalloc(sizeof(struct xfs_mount_args), KM_SLEEP); 78 args = kzalloc(sizeof(struct xfs_mount_args), GFP_KERNEL);
79 if (!args)
80 return NULL;
81
79 args->logbufs = args->logbufsize = -1; 82 args->logbufs = args->logbufsize = -1;
80 strncpy(args->fsname, sb->s_id, MAXNAMELEN); 83 strncpy(args->fsname, sb->s_id, MAXNAMELEN);
81 84
@@ -1396,9 +1399,13 @@ xfs_fs_remount(
1396 char *options) 1399 char *options)
1397{ 1400{
1398 struct xfs_mount *mp = XFS_M(sb); 1401 struct xfs_mount *mp = XFS_M(sb);
1399 struct xfs_mount_args *args = xfs_args_allocate(sb, 0); 1402 struct xfs_mount_args *args;
1400 int error; 1403 int error;
1401 1404
1405 args = xfs_args_allocate(sb, 0);
1406 if (!args)
1407 return -ENOMEM;
1408
1402 error = xfs_parseargs(mp, options, args, 1); 1409 error = xfs_parseargs(mp, options, args, 1);
1403 if (error) 1410 if (error)
1404 goto out_free_args; 1411 goto out_free_args;
@@ -1420,7 +1427,7 @@ xfs_fs_remount(
1420 } 1427 }
1421 1428
1422 out_free_args: 1429 out_free_args:
1423 kmem_free(args); 1430 kfree(args);
1424 return -error; 1431 return -error;
1425} 1432}
1426 1433
@@ -1725,9 +1732,13 @@ xfs_fs_fill_super(
1725{ 1732{
1726 struct inode *root; 1733 struct inode *root;
1727 struct xfs_mount *mp = NULL; 1734 struct xfs_mount *mp = NULL;
1728 struct xfs_mount_args *args = xfs_args_allocate(sb, silent); 1735 struct xfs_mount_args *args;
1729 int flags = 0, error; 1736 int flags = 0, error;
1730 1737
1738 args = xfs_args_allocate(sb, silent);
1739 if (!args)
1740 return -ENOMEM;
1741
1731 mp = xfs_mount_init(); 1742 mp = xfs_mount_init();
1732 1743
1733 INIT_LIST_HEAD(&mp->m_sync_list); 1744 INIT_LIST_HEAD(&mp->m_sync_list);
@@ -1826,7 +1837,7 @@ xfs_fs_fill_super(
1826 1837
1827 xfs_itrace_exit(XFS_I(sb->s_root->d_inode)); 1838 xfs_itrace_exit(XFS_I(sb->s_root->d_inode));
1828 1839
1829 kmem_free(args); 1840 kfree(args);
1830 return 0; 1841 return 0;
1831 1842
1832 error2: 1843 error2:
@@ -1874,7 +1885,7 @@ xfs_fs_fill_super(
1874 kmem_free(mp); 1885 kmem_free(mp);
1875 1886
1876 fail_vfsop: 1887 fail_vfsop:
1877 kmem_free(args); 1888 kfree(args);
1878 return -error; 1889 return -error;
1879} 1890}
1880 1891