From patchwork Wed Mar 3 07:05:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 83284 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2376dJM006496 for ; Wed, 3 Mar 2010 07:06:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755247Ab0CCHF6 (ORCPT ); Wed, 3 Mar 2010 02:05:58 -0500 Received: from mail-bw0-f212.google.com ([209.85.218.212]:40618 "EHLO mail-bw0-f212.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755105Ab0CCHF4 (ORCPT ); Wed, 3 Mar 2010 02:05:56 -0500 Received: by bwz4 with SMTP id 4so770081bwz.28 for ; Tue, 02 Mar 2010 23:05:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mail-followup-to:mime-version:content-type :content-disposition:user-agent; bh=3/qruGrs6C3A7d9VMwGBm9MWpoDvgHRlusOEAUBwy5E=; b=GVEcc5gNip3FKsHPLzyU3UhyeBH/z2v1S1OpMHrQgEUoqnzsJo7HQtFoSRTi+BcdKq EgOoo130ivRBhDC6phfep7gjqlkbq3I1oy4eKc+UEFSyMtnNuQDEdTnYgIio3AYwriME PdLw2p2vVdUL1pbFTWKzqvAZmc3PgvTl8GLfg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mail-followup-to:mime-version :content-type:content-disposition:user-agent; b=xK/PFzp29pU3QBwuXtOozgcz5xV9HlqvgbYuZYWbpdJdwZUDdx5kVR+DlM/L1eesJi hXXUgUMP9vZvQvAXfMsYcDbPHL4cKlkCGPTogWXyeNuaXznQ1TzGONklXJ5F6+9vbuAL jGzhbEOt/rkJ9CuGOPX7l1W3r3E1WHX9wjpZ4= Received: by 10.204.34.3 with SMTP id j3mr1186816bkd.23.1267599954387; Tue, 02 Mar 2010 23:05:54 -0800 (PST) Received: from bicker ([196.0.7.1]) by mx.google.com with ESMTPS id 24sm48367bkr.0.2010.03.02.23.05.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 02 Mar 2010 23:05:52 -0800 (PST) Date: Wed, 3 Mar 2010 10:05:44 +0300 From: Dan Carpenter To: Dmitry Torokhov Cc: Scott Moreau , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] gamecon: fix off by one range check Message-ID: <20100303070544.GB5086@bicker> Mail-Followup-To: Dan Carpenter , Dmitry Torokhov , Scott Moreau , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 03 Mar 2010 07:06:40 +0000 (UTC) diff --git a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c index ae998d9..7a55714 100644 --- a/drivers/input/joystick/gamecon.c +++ b/drivers/input/joystick/gamecon.c @@ -819,7 +819,7 @@ static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type) int i; int err; - if (pad_type < 1 || pad_type > GC_MAX) { + if (pad_type < 1 || pad_type >= GC_MAX) { pr_err("Pad type %d unknown\n", pad_type); return -EINVAL; }