Re: [PATCH] reiserfs: kstrdup() memory handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Mar 21, 2015 at 01:00:13PM -0400, Sanidhya Kashyap wrote:
> Checking for ENOMEM even for new_opts in reiserfs_remount function as
> there is a possibility of nothing being allocated.

You don't need to add a new label; kfree(NULL) is a no-op.

> Signed-off-by: Sanidhya Kashyap <sanidhya.gatech@xxxxxxxxx>
> ---
>  fs/reiserfs/super.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
> index 71fbbe3..bf9bc66 100644
> --- a/fs/reiserfs/super.c
> +++ b/fs/reiserfs/super.c
> @@ -1397,6 +1397,11 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
>  	int i;
>  #endif
>  
> +	if (!new_opts) {
> +		err = -ENOMEM;
> +		goto out_err_no_kfree;
> +	}
> +
>  	sync_filesystem(s);
>  	reiserfs_write_lock(s);
>  
> @@ -1549,6 +1554,7 @@ out_err_unlock:
>  	reiserfs_write_unlock(s);
>  out_err:
>  	kfree(new_opts);
> +out_err_no_kfree:
>  	return err;
>  }
>  
> -- 
> 2.1.0
> 
--
To unsubscribe from this list: send the line "unsubscribe reiserfs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux File System Development]     [Linux BTRFS]     [Linux NFS]     [Linux Filesystems]     [Ext4 Filesystem]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Resources]

  Powered by Linux