From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753858AbdJJTLg (ORCPT ); Tue, 10 Oct 2017 15:11:36 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:46311 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753395AbdJJTLf (ORCPT ); Tue, 10 Oct 2017 15:11:35 -0400 X-Google-Smtp-Source: AOwi7QBrmrhp6iZNSl0UQMcssD9QiXZX6SfrqAd19ZHoCPFpySnJgBuuWrYNB5vcgZUMQDUGTzpLEA== Date: Tue, 10 Oct 2017 21:11:30 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Mario Limonciello 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 Message-ID: <20171010191130.5octjwhbxouayxfv@pali> References: <897883f9b8c45dc2cb24de1bb4642513734852d3.1507589249.git.mario.limonciello@dell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <897883f9b8c45dc2cb24de1bb4642513734852d3.1507589249.git.mario.limonciello@dell.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- Pali Rohár pali.rohar@gmail.com