From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757404AbcAYPcr (ORCPT ); Mon, 25 Jan 2016 10:32:47 -0500 Received: from canardo.mork.no ([148.122.252.1]:44113 "EHLO canardo.mork.no" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751913AbcAYPcn convert rfc822-to-8bit (ORCPT ); Mon, 25 Jan 2016 10:32:43 -0500 From: =?utf-8?Q?Bj=C3=B8rn_Mork?= To: Alan Stern Cc: Emilio =?utf-8?Q?L=C3=B3pez?= , , , , , , , , , , Subject: Re: [PATCH v2] usb: devio: Add ioctl to disallow detaching kernel USB drivers. Organization: m References: Date: Mon, 25 Jan 2016 16:32:14 +0100 In-Reply-To: (Alan Stern's message of "Mon, 25 Jan 2016 10:21:21 -0500 (EST)") Message-ID: <8737tln08x.fsf@nemi.mork.no> User-Agent: Gnus/5.130013 (Ma Gnus v0.13) Emacs/24.5 (gnu/linux) 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 Alan Stern writes: > On Mon, 25 Jan 2016, Bjørn Mork wrote: > >> I don't feel much like an expert here, but I can certainly make up an >> opinion anyway :) >> >> Since 64bits kernels allow usb devio with interface numbers up to 63, I >> guess you need __u64 to avoid limiting the range? Limiting will create >> all sorts of followup problems, so it's definitely easiest to just go >> with __u64. > > But the Linux USB stack only allows up to 32 interfaces (see > include/linux/usb.h): > > /* this maximum is arbitrary */ > #define USB_MAXINTERFACES 32 Ah, I totally missed that. Thanks > So there's no point using a 64-bit value. > > On the other hand, this value is supposed to be the same size as > ps->ifclaimed, which is used as an argument to clear_bit(), set_bit(), > and test_bit(). Those routines require unsigned long. Maybe the input to these should be clamped to USB_MAXINTERFACES? Bjørn