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] [day] [month] [year] [list]
Date:	Fri, 01 Mar 2013 16:15:45 -0500 (EST)
From:	David Miller <davem@...emloft.net>
To:	freddy@...x.com.tw
Cc:	netdev@...r.kernel.org, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org, louis@...x.com.tw
Subject: Re: [PATCH resubmit] ax88179_178a: ASIX AX88179_178A USB 3.0/2.0
 to gigabit ethernet adapter driver

From: Freddy Xin <freddy@...x.com.tw>
Date: Wed, 27 Feb 2013 20:01:58 +0800

> +	eeprom_buff = kmalloc(sizeof(u16) * (last_word - first_word + 1),
> +			      GFP_KERNEL);
> +	if (!eeprom_buff)
> +		return -ENOMEM;
> +
> +	/* ax88179/178A returns 2 bytes from eeprom on read */
> +	for (i = first_word; i <= last_word; i++) {
> +		ret = __ax88179_read_cmd(dev, AX_ACCESS_EEPROM, i, 1, 2,
> +					 &eeprom_buff[i - first_word],
> +					 0);
> +		if (ret < 0)
> +			return -EIO;

In this -EIO error path we will leak eeprom_buff, you must free it in
all possible exit cases of this function after the allocation succeeds.

> +	data->rxctl = (__force __le16)(AX_RX_CTL_START | AX_RX_CTL_AB |
> +				       AX_RX_CTL_IPE);

You're not storying a __le16 in data->rxctl, you're storing the bits
in cpu endianness.  So make it a plain u16 instead and get rid of
these pointless casts.

> +static int __init asix_init(void)
> +{
> +	return usb_register(&asix_driver);
> +}
> +module_init(asix_init);
> +
> +static void __exit asix_exit(void)
> +{
> +	usb_deregister(&asix_driver);
> +}
> +module_exit(asix_exit);

You can replace all of this with a simple:

module_usb_driver(asix_driver);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ