lkml.org 
[lkml]   [2018]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] ext4: missing !bh check in ext4_xattr_inode_write()
On Thu, Nov 08, 2018 at 09:46:30AM +0300, Vasily Averin wrote:
> diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
> index 0b9688683526..415f73d4c9e6 100644
> --- a/fs/ext4/xattr.c
> +++ b/fs/ext4/xattr.c
> @@ -1384,6 +1384,12 @@ static int ext4_xattr_inode_write(handle_t *handle, struct inode *ea_inode,
> bh = ext4_getblk(handle, ea_inode, block, 0);
> if (IS_ERR(bh))
> return PTR_ERR(bh);
> + if (!bh) {
> + WARN_ON_ONCE(1);
> + __ext4_error_inode(ea_inode, __func__, __LINE__, 0,
> + "ext4_getblk() return bh = NULL");

You should use EXT4_ERROR_INODE(), defined in ext4.h, not
__ext4_error_inode(). That way you don't need to explicitly specify
__func__ and __LINE__, and we the compiler will correctly do printf
format checking even when CONFIG_PRINTK is not set.

- Ted

\
 
 \ /
  Last update: 2018-11-08 15:55    [W:0.125 / U:2.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site