From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752197AbdJKMeJ convert rfc822-to-8bit (ORCPT ); Wed, 11 Oct 2017 08:34:09 -0400 Received: from www.llwyncelyn.cymru ([82.70.14.225]:44280 "EHLO fuzix.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751958AbdJKMeH (ORCPT ); Wed, 11 Oct 2017 08:34:07 -0400 Date: Wed, 11 Oct 2017 13:33:18 +0100 From: Alan Cox To: Cc: , , , , , , , , , , Subject: Re: [PATCH v6 13/14] platform/x86: wmi: create character devices when requested by drivers Message-ID: <20171011133318.59765227@alans-desktop> In-Reply-To: References: <897883f9b8c45dc2cb24de1bb4642513734852d3.1507589249.git.mario.limonciello@dell.com> <20171010191130.5octjwhbxouayxfv@pali> Organization: Intel Corporation X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 10 Oct 2017 19:24:11 +0000 wrote: > > -----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. Maybe but you can still write the test correctly using >= instead. Alan