From patchwork Tue Jul 28 07:59:47 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roel Kluin X-Patchwork-Id: 37681 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6S7v7a6022184 for ; Tue, 28 Jul 2009 07:57:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750947AbZG1H5E (ORCPT ); Tue, 28 Jul 2009 03:57:04 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751232AbZG1H5E (ORCPT ); Tue, 28 Jul 2009 03:57:04 -0400 Received: from mail-ew0-f226.google.com ([209.85.219.226]:39012 "EHLO mail-ew0-f226.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750862AbZG1H5D (ORCPT ); Tue, 28 Jul 2009 03:57:03 -0400 Received: by ewy26 with SMTP id 26so3767834ewy.37 for ; Tue, 28 Jul 2009 00:57:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=7vPAFOcY5A6E9dZnjShfbIhfG3vbihJvFZleGaTCx+Y=; b=n5nqnIokZ8KxOcI3xL7Go3x1TeqkEc9o2z5h2pzeU7VMd38j2LWB0E/utN8gW0q7fD Fa5ojjJ4vx/Tv/7VoDiGB3af4zoQbvXLw7Jhp+8PipeJXVpp5Kk+4pYE6H2H90qFjrBN hy0j3h/gTKi1uPwKo5W6Cu/rIpcs0K431mXz4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=X9/Rkr2wnpvqGGnleCyUdxYQrNqmf4/Wo10xO94SGwYzbrF8mvy8M+v/UiwNNiJpXu Svp3V0IL7zA+PJVJK0aqLEcKV8JpsJzevFGX5Iv4LDnQpRZqjOEeFDtXmwb+8AcdHL3d JtTn49XT3QjEeNUgDeMnueFQK660f1Q31apsk= Received: by 10.210.44.12 with SMTP id r12mr400405ebr.24.1248767821396; Tue, 28 Jul 2009 00:57:01 -0700 (PDT) Received: from zoinx.mars (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 28sm1058181eyg.0.2009.07.28.00.57.00 (version=SSLv3 cipher=RC4-MD5); Tue, 28 Jul 2009 00:57:00 -0700 (PDT) Message-ID: <4A6EAFF3.8050502@gmail.com> Date: Tue, 28 Jul 2009 09:59:47 +0200 From: Roel Kluin User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2 MIME-Version: 1.0 To: dcbw@redhat.com, libertas-dev@lists.infradead.org, linux-wireless@vger.kernel.org, Andrew Morton Subject: [PATCH] libertas: Read outside array bounds Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org reads bss->rates[j] before checking bounds of index, and should use ARRAY_SIZE to determine the size of the array. Signed-off-by: Roel Kluin Acked-by: Holger Schurig Acked-by: Dan Williams --- -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index 601b542..6c95af3 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c @@ -5,6 +5,7 @@ * for sending scan commands to the firmware. */ #include +#include #include #include #include @@ -876,7 +877,7 @@ static inline char *lbs_translate_scan(struct lbs_private *priv, iwe.u.bitrate.disabled = 0; iwe.u.bitrate.value = 0; - for (j = 0; bss->rates[j] && (j < sizeof(bss->rates)); j++) { + for (j = 0; j < ARRAY_SIZE(bss->rates) && bss->rates[j]; j++) { /* Bit rate given in 500 kb/s units */ iwe.u.bitrate.value = bss->rates[j] * 500000; current_val = iwe_stream_add_value(info, start, current_val,