From patchwork Mon Oct 26 14:28:11 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roel Kluin X-Patchwork-Id: 55891 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 n9QEIM17022663 for ; Mon, 26 Oct 2009 14:18:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752164AbZJZORi (ORCPT ); Mon, 26 Oct 2009 10:17:38 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752014AbZJZORi (ORCPT ); Mon, 26 Oct 2009 10:17:38 -0400 Received: from mail-ew0-f207.google.com ([209.85.219.207]:50416 "EHLO mail-ew0-f207.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751783AbZJZORh (ORCPT ); Mon, 26 Oct 2009 10:17:37 -0400 Received: by ewy3 with SMTP id 3so3576741ewy.17 for ; Mon, 26 Oct 2009 07:17:40 -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=HvtpPRrfj1xHuqQGoYbQ8yGJ7k8wuGajgtCQwOPa0Yo=; b=ZRv0H5f7DiWXpGgLcrJw2WV4NM9jZwCPQ2hIiEqFfK9zHNyzZm49Fm/aFrd82TXypW u9eaezcK+lJn+wQPbitIWFosrbEB/iOblQc9q+M3/XEym5FqHuhXSVADlxHgL0dRjrPa WUq1ioOx6ioGW+jWnfqhp+tIRn/i4X8j6Yuek= 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=Jin7oCw3ju63McYMi38tIN8HN28FgV/t52u8/s/Z4FbYO803DSgKI7Uv+GR1RXBSl8 NQz0obgpT/jzPf8VkFeHH/h8hSIXvLC4Mbh8gtvDMbGguFtitZkCXNBveAKqY2GCLh1+ f0fiytbBhsSySvPOE61KzmG3CSgXWrTnWHUAE= Received: by 10.211.161.5 with SMTP id n5mr3440061ebo.89.1256566660175; Mon, 26 Oct 2009 07:17:40 -0700 (PDT) Received: from zoinx.mars (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 24sm4010041eyx.21.2009.10.26.07.17.38 (version=SSLv3 cipher=RC4-MD5); Mon, 26 Oct 2009 07:17:39 -0700 (PDT) Message-ID: <4AE5B1FB.2050306@gmail.com> Date: Mon, 26 Oct 2009 15:28:11 +0100 From: Roel Kluin User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Thunderbird/3.0b4 MIME-Version: 1.0 To: "John W. Linville" , linux-wireless@vger.kernel.org, Andrew Morton , LKML Subject: [PATCH] airo: Reorder tests, check bounds before element Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 7116a1a..abf896a 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c @@ -4790,9 +4790,8 @@ static int proc_stats_rid_open( struct inode *inode, static int get_dec_u16( char *buffer, int *start, int limit ) { u16 value; int valid = 0; - for( value = 0; buffer[*start] >= '0' && - buffer[*start] <= '9' && - *start < limit; (*start)++ ) { + for (value = 0; *start < limit && buffer[*start] >= '0' && + buffer[*start] <= '9'; (*start)++) { valid = 1; value *= 10; value += buffer[*start] - '0';