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:	Sat, 26 Oct 2013 21:28:50 +0200
From:	Pali Rohár <pali.rohar@...il.com>
To:	Joe Perches <joe@...ches.com>
Cc:	Marcel Holtmann <marcel@...tmann.org>,
	Gustavo Padovan <gustavo@...ovan.org>,
	Johan Hedberg <johan.hedberg@...il.com>,
	Pavel Machek <pavel@....cz>, linux-kernel@...r.kernel.org,
	linux-bluetooth@...r.kernel.org,
	Ивайло Димитров 
	<freemangordon@....bg>,
	Joni Lapilainen <joni.lapilainen@...il.com>,
	Sebastian Reichel <sre@...g0.de>,
	Aaro Koskinen <aaro.koskinen@....fi>
Subject: Re: [PATCH] Bluetooth: Add hci_h4p driver

On Thursday 24 October 2013 20:41:53 Joe Perches wrote:
> On Fri, 2013-10-18 at 12:30 +0200, Pali Rohár wrote:
> > I rebased patch on top of
> > https://git.kernel.org/cgit/linux/kernel/git/bluetooth/blue
> > tooth-next.git branch master
> 
> Hi Pali, just some trivial notes:
> 
> []
> 
> +static ssize_t hci_h4p_show_bdaddr(struct device *dev,
> 
> > +                                  struct device_attribute
> > *attr, char *buf) +{
> > +       struct hci_h4p_info *info = dev_get_drvdata(dev);
> > +
> > +       return sprintf(buf,
> > "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", +                     
> > info->bd_addr[0], info->bd_addr[1], info->bd_addr[2], +    
> >                  info->bd_addr[3], info->bd_addr[4],
> > info->bd_addr[5]);
> 
> sprintf(buf, "%pM", info->bd_addr)
> 

"%pM" modifier printing mac address?

> and if this is really bluetooth, does the output need to
> be emitted in reverse order?  ie: %pMR
> 

I'm sure that actual order of above code is correct.
So what to use? "%pM" or "%pMR"?

> []
> 
> > +#define NBT_DBG(fmt, arg...) \
> > +               pr_debug("%s: " fmt "" , __func__ , ## arg)
> > +
> > +#define NBT_DBG_FW(fmt, arg...) \
> > +               pr_debug("%s: " fmt "" , __func__ , ## arg)
> > +
> > +#define NBT_DBG_POWER(fmt, arg...) \
> > +               pr_debug("%s: " fmt "" , __func__ , ## arg)
> > +
> > +#define NBT_DBG_TRANSFER(fmt, arg...) \
> > +               pr_debug("%s: " fmt "" , __func__ , ## arg)
> > +
> > +#define NBT_DBG_TRANSFER_NF(fmt, arg...) \
> > +               pr_debug(fmt "" , ## arg)
> > +
> > +#define NBT_DBG_DMA(fmt, arg...) \
> > +               pr_debug("%s: " fmt "" , __func__ , ## arg)
> 
> The "" isn't useful.
> 
> dynamic_debugging can add __func__ to each message output
> with +f.
> 
> I think all of these should be converted to pr_debug
> where used or consolidated into a single
> #define nbt_dbg(mask, fmt, ...)			\
> do {						\
> 	if (mask & debug)			\
> 		pr_debug(fmt, ##__VA_ARGS__);
> } while (0)
> 
> and used like:
> 	nbt_dbg(TRANSFER, fmt, etc...);
> where debug is some static.
> 
> Also there are many uses missing "\n" which can
> cause interleaving problems with other printks.
> 
> []
> 
> > +int hci_h4p_wait_for_cts(struct hci_h4p_info *info, int
> > active, +                        int timeout_ms)
> > +{
> > +       unsigned long timeout;
> > +       int state;
> > +
> > +       timeout = jiffies + msecs_to_jiffies(timeout_ms);
> > +       for (;;) {
> 
> 	while (time_before(jiffies, timeout)) {
> 
> > +               state = hci_h4p_inb(info, UART_MSR) &
> > UART_MSR_CTS; +               if (active) {
> > +                       if (state)
> > +                               return 0;
> > +               } else {
> > +                       if (!state)
> > +                               return 0;
> > +               }
> > +               if (time_after(jiffies, timeout))
> > +                       return -ETIMEDOUT;
> > 
> > +               msleep(1);
> > +       }
> 
> 	return -ETIMEDOUT;
> 
> > +}

-- 
Pali Rohár
pali.rohar@...il.com

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ