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]
Date:	Thu, 10 May 2012 16:22:27 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Markus Franke <markus.franke@...02.tu-chemnitz.de>
Cc:	Greg KH <greg@...ah.com>, Evgeniy Polyakov <zbr@...emap.net>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] w1: Add 1-wire slave device driver for DS28E04-100

On Fri, 11 May 2012 00:57:58 +0200
Markus Franke <markus.franke@...02.tu-chemnitz.de> wrote:

> +static int w1_f1C_add_slave(struct w1_slave *sl)
> +{
> +	int err = 0;
> +	int i;
> +	struct w1_f1C_data *data = NULL;
> +
> +	if (w1_enable_crccheck) {
> +		data = kzalloc(sizeof(struct w1_f1C_data), GFP_KERNEL);
> +		if (!data)
> +			return -ENOMEM;
> +		sl->family_data = data;
> +	}
> +
> +	/* create binary sysfs attributes */
> +	for (i = 0; i < NB_SYSFS_BIN_FILES && !err; ++i)
> +		err = sysfs_create_bin_file(
> +			&sl->dev.kobj, &(w1_f1C_bin_attr[i]));
> +
> +	if (err)
> +		goto out;

If this goto is taken, we will leak 0..i sysfs files.

> +	/* create device attributes */
> +	err = device_create_file(&sl->dev, &dev_attr_crccheck);
> +
> +	if (err) {
> +		/* remove binary sysfs attributes */
> +		for (i = 0; i < NB_SYSFS_BIN_FILES; ++i)
> +			sysfs_remove_bin_file(
> +				&sl->dev.kobj, &(w1_f1C_bin_attr[i]));
> +	}
> +
> +out:
> +	if (err) {
> +		if (w1_enable_crccheck)
> +			kfree(data);

kfree(NULL) is legal - the w1_enable_crccheck test can be removed.

> +	}
> +
> +	return err;
> +}
--
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