lkml.org 
[lkml]   [2010]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] ext3: Check return value of sb_getblk()
From
Date
2010-10-19 (화), 15:34 +0900, Namhyung Kim:
> Check return value of sb_getblk() is NULL. unlikely is addded here
> since it is called from a loop and we've been OK without the check
> until now.
>
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> ---
> fs/ext3/inode.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
> index ef1c23a..a7ac778 100644
> --- a/fs/ext3/inode.c
> +++ b/fs/ext3/inode.c
> @@ -655,6 +655,12 @@ static int ext3_alloc_branch(handle_t *handle, struct inode *inode,
> * parent to disk.
> */
> bh = sb_getblk(inode->i_sb, new_blocks[n-1]);
> + if (unlikely(!bh)) {
> + n--;
> + err = -ENOMEM;
> + goto failed;
> + }
> +
> branch[n].bh = bh;
> lock_buffer(bh);
> BUFFER_TRACE(bh, "call get_create_access");

Maybe EIO would be more proper error code, I guess.


--
Regards,
Namhyung Kim


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2010-10-19 09:59    [W:0.620 / U:0.904 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site