public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: mysterious -1 offset in staging rt2860 driver
Date: Thu, 04 Mar 2010 19:14:03 +0000	[thread overview]
Message-ID: <20100304191403.GA24075@bicker> (raw)

So here is a mystery for people who enjoy such mysterious things.

drivers/staging/rt2860/sta_ioctl.c +1020 rt_ioctl_giwscan(219)
  1011                  if (CAP_IS_PRIVACY_ON
  1012                      (pAdapter->ScanTab.BssEntry[i].CapabilityInfo))
  1013                          iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
  1014                  else
  1015                          iwe.u.data.flags = IW_ENCODE_DISABLED;
  1016
  1017                  __smatch_value("iwe.u.data.flags");
  1018                  previous_ev = current_ev;
  1019                  current_ev   1020                      iwe_stream_add_point(info, current_ev, end_buf, &iwe,
  1021                                           (char *)pAdapter->
  1022                                           SharedKey[BSS0][(iwe.u.data.
  1023                                                            flags &
  1024                                                            IW_ENCODE_INDEX) -
  1025                                                           1].Key);


That last bit is easier to read if it's on one line.

SharedKey[BSS0][(iwe.u.data.flags & IW_ENCODE_INDEX) - 1].Key);

iwe.u.data.flags is either 0x0400 or 0x8000.  IW_ENCODE_INDEX is 0xff, so
after we mask off the lower bits we get 0x00 and then we subtract 1 we get
an array offset of -1.

I doubt that's what we want, but what _do_ we want here?

regards,
dan carpenter

             reply	other threads:[~2010-03-04 19:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-04 19:14 Dan Carpenter [this message]
2010-03-05  9:44 ` mysterious -1 offset in staging rt2860 driver walter harms
2010-03-06  0:21 ` Darren Jenkins

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=20100304191403.GA24075@bicker \
    --to=error27@gmail.com \
    --cc=kernel-janitors@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox