Check the return value of xfs_buf_read() for NULL and return ENOMEM
if it is NULL. This is necessary in a few spots to avoid subsequent
code blindly dereferencing the null buffer pointer.
Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
bp = xfs_buf_read(mp->m_ddev_targp, buf_f->blf_blkno, buf_f->blf_len,
buf_flags);
+ if (!bp)
+ return XFS_ERROR(ENOMEM);
error = xfs_buf_geterror(bp);
if (error) {
xfs_ioerror_alert("xlog_recover_do..(read#1)", mp,
bp = xfs_buf_read(mp->m_ddev_targp, in_f->ilf_blkno, in_f->ilf_len,
XBF_LOCK);
+ if (!bp) {
+ error = ENOMEM;
+ goto error;
+ }
error = xfs_buf_geterror(bp);
if (error) {
xfs_ioerror_alert("xlog_recover_do..(read#2)", mp,
bp = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt),
XBF_LOCK | XBF_MAPPED | XBF_DONT_BLOCK);
+ if (!bp)
+ return XFS_ERROR(ENOMEM);
error = xfs_buf_geterror(bp);
if (error) {
xfs_ioerror_alert("xfs_readlink",