[PATCH 4/7] ubifs: do not ubifs_inode() on potentially NULL pointer

Richard Weinberger richard.weinberger at gmail.com
Sun Jan 19 11:58:29 PST 2020


On Wed, Nov 6, 2019 at 10:17 AM Sascha Hauer <s.hauer at pengutronix.de> wrote:
>
> new_inode() may return NULL, so only derefence the return inode when
> non NULL. This is merely a cleanup as calling ubifs_inode() on a NULL
> pointer doesn't do any harm, only using the return value would.
>
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> ---
>  fs/ubifs/dir.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
> index 0b98e3c8b461..cfce5fee9262 100644
> --- a/fs/ubifs/dir.c
> +++ b/fs/ubifs/dir.c
> @@ -95,10 +95,10 @@ struct inode *ubifs_new_inode(struct ubifs_info *c, struct inode *dir,
>         }
>
>         inode = new_inode(c->vfs_sb);
> -       ui = ubifs_inode(inode);
>         if (!inode)
>                 return ERR_PTR(-ENOMEM);
>
> +       ui = ubifs_inode(inode);
>         /*
>          * Set 'S_NOCMTIME' to prevent VFS form updating [mc]time of inodes and
>          * marking them dirty in file write path (see 'file_update_time()').

Acked-by: Richard Weinberger <richard at nod.at>

-- 
Thanks,
//richard



More information about the linux-mtd mailing list