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: <20170317152600.GD8723@amd>
Date:   Fri, 17 Mar 2017 16:26:00 +0100
From:   Pavel Machek <pavel@....cz>
To:     Sebastian Reichel <sre@...nel.org>
Cc:     Marcel Holtmann <marcel@...tmann.org>,
        Gustavo Padovan <gustavo@...ovan.org>,
        Johan Hedberg <johan.hedberg@...il.com>,
        Rob Herring <robh+dt@...nel.org>,
        Tony Lindgren <tony@...mide.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jiri Slaby <jslaby@...e.com>,
        Mark Rutland <mark.rutland@....com>,
        linux-bluetooth@...r.kernel.org, linux-serial@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        Rob Herring <robh@...nel.org>
Subject: Re: [PATCH 04/10] Bluetooth: hci_uart: add serdev driver support
 library

Hi!

> From: Rob Herring <robh@...nel.org>
> 
> This adds library functions for serdev based BT drivers. This is largely
> copied from hci_ldisc.c and modified to use serdev calls. There's a little
> bit of duplication, but I avoided intermixing this as the ldisc code should
> eventually go away.
> 
> Signed-off-by: Rob Herring <robh@...nel.org>
> Cc: Marcel Holtmann <marcel@...tmann.org>
> Cc: Gustavo Padovan <gustavo@...ovan.org>
> Cc: Johan Hedberg <johan.hedberg@...il.com>
> Cc: linux-bluetooth@...r.kernel.org
> Tested-By: Sebastian Reichel <sre@...nel.org>

Trivial comments below.

> @@ -0,0 +1,370 @@
> +/*
> + *
> + *  Bluetooth HCI serdev driver lib

Just one empty line.

> + *  You should have received a copy of the GNU General Public License
> + *  along with this program; if not, write to the Free Software
> + *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
> + *
> + */

I don't think we put the address in there any more.

> +static void hci_uart_write_work(struct work_struct *work)
> +{
> +	struct hci_uart *hu = container_of(work, struct hci_uart, write_work);
> +	struct serdev_device *serdev = hu->serdev;
> +	struct hci_dev *hdev = hu->hdev;
> +	struct sk_buff *skb;
> +
> +	/* REVISIT: should we cope with bad skbs or ->write() returning
> +	 * and error value ?
> +	 */

"an error value"? Comment style?

> +restart:
> +	clear_bit(HCI_UART_TX_WAKEUP, &hu->tx_state);
> +
> +	while ((skb = hci_uart_dequeue(hu))) {
> +		int len;
> +
> +		len = serdev_device_write_buf(serdev, skb->data, skb->len);
> +		hdev->stat.byte_tx += len;
> +
> +		skb_pull(skb, len);
> +		if (skb->len) {
> +			hu->tx_skb = skb;
> +			break;
> +		}
> +
> +		hci_uart_tx_complete(hu, hci_skb_pkt_type(skb));
> +		kfree_skb(skb);
> +	}
> +
> +	if (test_bit(HCI_UART_TX_WAKEUP, &hu->tx_state))
> +		goto restart;

do {} while () instead of goto?

> +/* ------- Interface to HCI layer ------ */
> +/* Initialize device */

Comment style?

> +	if (hu->proto->set_baudrate && speed) {
> +		err = hu->proto->set_baudrate(hu, speed);
> +		if (!err)
> +			serdev_device_set_baudrate(hu->serdev, speed);
> +	}

Complain about the error here?

> +	if (skb->len != sizeof(*ver)) {
> +		BT_ERR("%s: Event length mismatch for version information",
> +		       hdev->name);
> +		goto done;
> +	}
> +
> +done:

Get rid of goto and label?

> +/* hci_uart_write_wakeup()
> + *
> + *    Callback for transmit wakeup. Called when low level
> + *    device driver can accept more send data.
> + *
> + * Arguments:        tty    pointer to associated tty instance data
> + * Return Value:    None
> + */

Kerneldoc? :-)

> +static void hci_uart_write_wakeup(struct serdev_device *serdev)
> +{
> +	struct hci_uart *hu = serdev_device_get_drvdata(serdev);
> +
> +	BT_DBG("");
> +
> +	if (!hu)
> +		return;
> +
> +	if (serdev != hu->serdev)
> +		return;

WARN_ON on both of these? That should not be normal condition...

> +	/* Only when vendor specific setup callback is provided, consider
> +	 * the manufacturer information valid. This avoids filling in the
> +	 * value for Ericsson when nothing is specified.
> +	 */

Is this comment still up-to-date?

Thanks,
									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ