diff options
author | Chandra Seetharaman <sekharan@us.ibm.com> | 2011-09-07 15:37:54 -0400 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2011-10-11 22:15:01 -0400 |
commit | b522950f0ab8551f2ef56c210ebd50e6c6396601 (patch) | |
tree | abdd6143268403b82de0e61296b2fe864ae98c10 /fs/xfs/xfs_fsops.c | |
parent | 04f658ee229f60dbb9a0dc2f3d6871b12b758051 (diff) |
xfs: Check the return value of xfs_buf_get()
Check the return value of xfs_buf_get() and fail appropriately.
Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_fsops.c')
-rw-r--r-- | fs/xfs/xfs_fsops.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index e023f940a3dd..1c6fdeb702ff 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c | |||
@@ -194,6 +194,10 @@ xfs_growfs_data_private( | |||
194 | bp = xfs_buf_get(mp->m_ddev_targp, | 194 | bp = xfs_buf_get(mp->m_ddev_targp, |
195 | XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)), | 195 | XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)), |
196 | XFS_FSS_TO_BB(mp, 1), XBF_LOCK | XBF_MAPPED); | 196 | XFS_FSS_TO_BB(mp, 1), XBF_LOCK | XBF_MAPPED); |
197 | if (!bp) { | ||
198 | error = ENOMEM; | ||
199 | goto error0; | ||
200 | } | ||
197 | agf = XFS_BUF_TO_AGF(bp); | 201 | agf = XFS_BUF_TO_AGF(bp); |
198 | memset(agf, 0, mp->m_sb.sb_sectsize); | 202 | memset(agf, 0, mp->m_sb.sb_sectsize); |
199 | agf->agf_magicnum = cpu_to_be32(XFS_AGF_MAGIC); | 203 | agf->agf_magicnum = cpu_to_be32(XFS_AGF_MAGIC); |
@@ -227,6 +231,10 @@ xfs_growfs_data_private( | |||
227 | bp = xfs_buf_get(mp->m_ddev_targp, | 231 | bp = xfs_buf_get(mp->m_ddev_targp, |
228 | XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)), | 232 | XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)), |
229 | XFS_FSS_TO_BB(mp, 1), XBF_LOCK | XBF_MAPPED); | 233 | XFS_FSS_TO_BB(mp, 1), XBF_LOCK | XBF_MAPPED); |
234 | if (!bp) { | ||
235 | error = ENOMEM; | ||
236 | goto error0; | ||
237 | } | ||
230 | agi = XFS_BUF_TO_AGI(bp); | 238 | agi = XFS_BUF_TO_AGI(bp); |
231 | memset(agi, 0, mp->m_sb.sb_sectsize); | 239 | memset(agi, 0, mp->m_sb.sb_sectsize); |
232 | agi->agi_magicnum = cpu_to_be32(XFS_AGI_MAGIC); | 240 | agi->agi_magicnum = cpu_to_be32(XFS_AGI_MAGIC); |
@@ -253,6 +261,10 @@ xfs_growfs_data_private( | |||
253 | XFS_AGB_TO_DADDR(mp, agno, XFS_BNO_BLOCK(mp)), | 261 | XFS_AGB_TO_DADDR(mp, agno, XFS_BNO_BLOCK(mp)), |
254 | BTOBB(mp->m_sb.sb_blocksize), | 262 | BTOBB(mp->m_sb.sb_blocksize), |
255 | XBF_LOCK | XBF_MAPPED); | 263 | XBF_LOCK | XBF_MAPPED); |
264 | if (!bp) { | ||
265 | error = ENOMEM; | ||
266 | goto error0; | ||
267 | } | ||
256 | block = XFS_BUF_TO_BLOCK(bp); | 268 | block = XFS_BUF_TO_BLOCK(bp); |
257 | memset(block, 0, mp->m_sb.sb_blocksize); | 269 | memset(block, 0, mp->m_sb.sb_blocksize); |
258 | block->bb_magic = cpu_to_be32(XFS_ABTB_MAGIC); | 270 | block->bb_magic = cpu_to_be32(XFS_ABTB_MAGIC); |
@@ -276,6 +288,10 @@ xfs_growfs_data_private( | |||
276 | XFS_AGB_TO_DADDR(mp, agno, XFS_CNT_BLOCK(mp)), | 288 | XFS_AGB_TO_DADDR(mp, agno, XFS_CNT_BLOCK(mp)), |
277 | BTOBB(mp->m_sb.sb_blocksize), | 289 | BTOBB(mp->m_sb.sb_blocksize), |
278 | XBF_LOCK | XBF_MAPPED); | 290 | XBF_LOCK | XBF_MAPPED); |
291 | if (!bp) { | ||
292 | error = ENOMEM; | ||
293 | goto error0; | ||
294 | } | ||
279 | block = XFS_BUF_TO_BLOCK(bp); | 295 | block = XFS_BUF_TO_BLOCK(bp); |
280 | memset(block, 0, mp->m_sb.sb_blocksize); | 296 | memset(block, 0, mp->m_sb.sb_blocksize); |
281 | block->bb_magic = cpu_to_be32(XFS_ABTC_MAGIC); | 297 | block->bb_magic = cpu_to_be32(XFS_ABTC_MAGIC); |
@@ -300,6 +316,10 @@ xfs_growfs_data_private( | |||
300 | XFS_AGB_TO_DADDR(mp, agno, XFS_IBT_BLOCK(mp)), | 316 | XFS_AGB_TO_DADDR(mp, agno, XFS_IBT_BLOCK(mp)), |
301 | BTOBB(mp->m_sb.sb_blocksize), | 317 | BTOBB(mp->m_sb.sb_blocksize), |
302 | XBF_LOCK | XBF_MAPPED); | 318 | XBF_LOCK | XBF_MAPPED); |
319 | if (!bp) { | ||
320 | error = ENOMEM; | ||
321 | goto error0; | ||
322 | } | ||
303 | block = XFS_BUF_TO_BLOCK(bp); | 323 | block = XFS_BUF_TO_BLOCK(bp); |
304 | memset(block, 0, mp->m_sb.sb_blocksize); | 324 | memset(block, 0, mp->m_sb.sb_blocksize); |
305 | block->bb_magic = cpu_to_be32(XFS_IBT_MAGIC); | 325 | block->bb_magic = cpu_to_be32(XFS_IBT_MAGIC); |