Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1502488
| From | Pavel Machek <pavel@ucw.cz> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | hci_ldisc: suspicious/buggy code |
| Date | 2016-10-17 23:40 +0200 |
| Message-ID | <stnNw-Pb-17@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
Hi!
hci_uart_set_flow_control() contains some rather suspicious
code. AFAICT:
set = 0.
Then we do set &= (magic constant). But as set is 0, it stays zero. It
just does not make sense. [Nor does it make sense to do |= on known
value of zero just after else. But that's probably just some artifact
of editing.]
(And if you edit the code anyway, temporary variable to store
TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 | TIOCM_OUT2 | TIOCM_LOOP would
make sense.)
Thanks,
Pavel
/* Flow control or un-flow control the device */
void hci_uart_set_flow_control(struct hci_uart *hu, bool enable)
{
...
unsigned int set = 0;
unsigned int clear = 0;
if (enable) {
...
set &= ~(TIOCM_OUT2 | TIOCM_RTS);
clear = ~set;
set &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 |
TIOCM_OUT2 | TIOCM_LOOP;
clear &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 |
TIOCM_OUT2 | TIOCM_LOOP;
status = tty->driver->ops->tiocmset(tty, set, clear);
BT_DBG("Clearing RTS: %s", status ? "failed" : "success");
} else {
...
set |= (TIOCM_OUT2 | TIOCM_RTS);
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
hci_ldisc: suspicious/buggy code Pavel Machek <pavel@ucw.cz> - 2016-10-17 23:40 +0200 Re: hci_ldisc: suspicious/buggy code Pavel Machek <pavel@ucw.cz> - 2016-10-18 00:00 +0200
csiph-web