lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150321171547.GA5663@thin>
Date:	Sat, 21 Mar 2015 10:15:47 -0700
From:	Josh Triplett <josh@...htriplett.org>
To:	Sanidhya Kashyap <sanidhya.gatech@...il.com>
Cc:	jack@...e.cz, jeffm@...e.com, akpm@...ux-foundation.org,
	fabf@...net.be, rashika.kheria@...il.com,
	reiserfs-devel@...r.kernel.org, linux-kernel@...r.kernel.org,
	taesoo@...ech.edu, changwoo@...ech.edu, sanidhya@...ech.edu,
	blee@...ech.edu
Subject: Re: [PATCH] reiserfs: kstrdup() memory handling

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@...il.com>
> ---
>  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 linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ