summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2013-02-27 08:13:45 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-11 09:47:13 -0700
commit72c1c06d91c54beee35613434a5efdd7e8909302 (patch)
tree3201360606bb541f3829a5d0516a68b48bfc632f
parenta0cdd2e4a96a253c83e8d7856e39b9807805c6c4 (diff)
downloadblackbird-op-linux-72c1c06d91c54beee35613434a5efdd7e8909302.tar.gz
blackbird-op-linux-72c1c06d91c54beee35613434a5efdd7e8909302.zip
wlan-ng: add a bounds check
I'm not sure where these results come from, but it can't hurt to add a sanity check the array offset. The .results[] array on the next line has HFA384x_CHINFORESULT_MAX (16) elements. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/wlan-ng/prism2sta.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
index dc221f2ad227..428a9be25010 100644
--- a/drivers/staging/wlan-ng/prism2sta.c
+++ b/drivers/staging/wlan-ng/prism2sta.c
@@ -1170,6 +1170,9 @@ static void prism2sta_inf_chinforesults(wlandevice_t *wlandev,
result = &inf->info.chinforesult.result[n];
chan = le16_to_cpu(result->chid) - 1;
+ if (chan < 0 || chan >= HFA384x_CHINFORESULT_MAX)
+ continue;
+
chinforesult = &hw->channel_info.results.result[chan];
chinforesult->chid = chan;
chinforesult->anl = le16_to_cpu(result->anl);
OpenPOWER on IntegriCloud