From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754433AbdJJTYP (ORCPT ); Tue, 10 Oct 2017 15:24:15 -0400 Received: from esa1.dell-outbound.iphmx.com ([68.232.153.90]:27441 "EHLO esa1.dell-outbound.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753822AbdJJTYN (ORCPT ); Tue, 10 Oct 2017 15:24:13 -0400 From: X-LoopCount0: from 10.166.132.169 X-IronPort-AV: E=Sophos;i="5.43,359,1503378000"; d="scan'208";a="560568004" X-DLP: DLP_GlobalPCIDSS To: CC: , , , , , , , , , Subject: RE: [PATCH v6 13/14] platform/x86: wmi: create character devices when requested by drivers Thread-Topic: [PATCH v6 13/14] platform/x86: wmi: create character devices when requested by drivers Thread-Index: AQHTQfuUVJPkCX96dkG+nEPDiaGWEqLdddUA Date: Tue, 10 Oct 2017 19:24:11 +0000 Message-ID: References: <897883f9b8c45dc2cb24de1bb4642513734852d3.1507589249.git.mario.limonciello@dell.com> <20171010191130.5octjwhbxouayxfv@pali> In-Reply-To: <20171010191130.5octjwhbxouayxfv@pali> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.143.242.75] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id v9AJOK0H004777 > -----Original Message----- > From: Pali Rohár [mailto:pali.rohar@gmail.com] > Sent: Tuesday, October 10, 2017 2:12 PM > To: Limonciello, Mario > Cc: dvhart@infradead.org; Andy Shevchenko ; > LKML ; platform-driver-x86@vger.kernel.org; > Andy Lutomirski ; quasisec@google.com; rjw@rjwysocki.net; > mjg59@google.com; hch@lst.de; Greg KH > Subject: Re: [PATCH v6 13/14] platform/x86: wmi: create character devices when > requested by drivers > > On Monday 09 October 2017 17:51:51 Mario Limonciello wrote: > > + /* make sure we're not calling a higher instance than exists*/ > > + if (_IOC_NR(cmd) > wblock->gblock.instance_count - 1) > > + return -EINVAL; > > Is this condition really working? instance_count is unsigned, cmd is > also unsigned... and when instance_count is zero, then IIRC error would > not be thrown. > But instance count can't be zero. MOF would fall apart with a zero instance count. If a broken BIOS was shipped with an instance count of zero bigger problems would have happened.