From patchwork Sun Jan 10 08:15:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 71976 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0A8FoFg021666 for ; Sun, 10 Jan 2010 08:15:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751133Ab0AJIPt (ORCPT ); Sun, 10 Jan 2010 03:15:49 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752135Ab0AJIPt (ORCPT ); Sun, 10 Jan 2010 03:15:49 -0500 Received: from mail-px0-f174.google.com ([209.85.216.174]:58737 "EHLO mail-px0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751133Ab0AJIPs (ORCPT ); Sun, 10 Jan 2010 03:15:48 -0500 Received: by pxi4 with SMTP id 4so2998439pxi.33 for ; Sun, 10 Jan 2010 00:15:48 -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:mime-version:content-type:content-disposition:user-agent; bh=J1hKfOu8SJNNn5VXOHvscX/ySWsDhIwble1Wy67HNBU=; b=JGP/xK0dYX+ICsDE8B+t6zf1TngR58UWoUmfuok8xGG+YQm1ZGvX+VqqBcmuZXD0NW 7RUwDMAHvxIqA+M7Z8dDjIULqLaodOxpOrp1HbQSBH7uRGLNXbFsl1iL5ilpif5cq7dJ tekcFVcN44P/0g4n6tXIMOT/amIF7mR5mNH1I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=g85tSSLIpbPGPB1rYNSvOMvIyCr9MA9yfv0t492MYh+R0VUGlMkg5dZr7dIovgaDv2 YNYnN3U4SoiL5y+aqBl+afra73Y2N2xRxtj9jjU/gxQPpD3mF+IffxV6TP1Dw0H7GOkw nrhE/vMAduKe57sdZOZbSOQQJPcsBli1YnOIY= Received: by 10.141.107.10 with SMTP id j10mr21099640rvm.225.1263111348386; Sun, 10 Jan 2010 00:15:48 -0800 (PST) Received: from mailhub.coreip.homeip.net (c-24-6-153-137.hsd1.ca.comcast.net [24.6.153.137]) by mx.google.com with ESMTPS id 21sm20243107pzk.11.2010.01.10.00.15.47 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 10 Jan 2010 00:15:47 -0800 (PST) Date: Sun, 10 Jan 2010 00:15:44 -0800 From: Dmitry Torokhov To: Mattia Dongili Cc: Len Brown , linux-acpi@vger.kernel.org Subject: [PATCH] sony-laptop - fix using of uninitialized variable Message-ID: <20100110081544.GD16057@core.coreip.homeip.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-08-17) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 5af5334..3f71a60 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c @@ -1201,9 +1201,12 @@ static void sony_nc_rfkill_setup(struct acpi_device *device) /* the buffer is filled with magic numbers describing the devices * available, 0xff terminates the enumeration */ - while ((dev_code = *(device_enum->buffer.pointer + i)) != 0xff && - i < device_enum->buffer.length) { - i++; + for (i = 0; i < device_enum->buffer.length; i++) { + + dev_code = *(device_enum->buffer.pointer + i); + if (dev_code == 0xff) + break; + dprintk("Radio devices, looking at 0x%.2x\n", dev_code); if (dev_code == 0 && !sony_rfkill_devices[SONY_WIFI])