All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com>,
	linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: SMP: Fix setting unknown auth_req bits
Date: Thu, 11 Oct 2012 17:00:56 +0200	[thread overview]
Message-ID: <20121011150056.GA31247@x220.example.org> (raw)
In-Reply-To: <20121011143355.GA28051@aemeltch-MOBL1>

Hi Andrei,

On Thu, Oct 11, 2012, Andrei Emeltchenko wrote:
> > @@ -230,7 +232,7 @@ static void build_pairing_cmd(struct l2cap_conn *conn,
> >  		req->max_key_size = SMP_MAX_ENC_KEY_SIZE;
> >  		req->init_key_dist = 0;
> >  		req->resp_key_dist = dist_keys;
> > -		req->auth_req = authreq;
> > +		req->auth_req = (authreq & AUTH_REQ_MASK);
> >  		return;
> >  	}
> >  
> > @@ -239,7 +241,7 @@ static void build_pairing_cmd(struct l2cap_conn *conn,
> >  	rsp->max_key_size = SMP_MAX_ENC_KEY_SIZE;
> >  	rsp->init_key_dist = 0;
> >  	rsp->resp_key_dist = req->resp_key_dist & dist_keys;
> > -	rsp->auth_req = authreq;
> > +	rsp->auth_req = (authreq & AUTH_REQ_MASK);
> 
> Would it be better to omit braces like in the line above? For both cases.

I actually didn't notice the line above the second chunk. I always
thought it was good practice to have explicit braces around bitwise
operations to avoid evaluation-order bugs (particularly in
if-statements) so I just always do it. I'll leave this to Gustavo or
Marcel to object to if necessary (otoh Marcel already gave his ack).

Johan

  reply	other threads:[~2012-10-11 15:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-11 14:26 [PATCH] Bluetooth: SMP: Fix setting unknown auth_req bits Johan Hedberg
2012-10-11 14:34 ` Andrei Emeltchenko
2012-10-11 15:00   ` Johan Hedberg [this message]
2012-10-12  9:56 ` Gustavo Padovan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121011150056.GA31247@x220.example.org \
    --to=johan.hedberg@gmail.com \
    --cc=andrei.emeltchenko.news@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.