Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757213AbXIQXgb (ORCPT ); Mon, 17 Sep 2007 19:36:31 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755235AbXIQXgW (ORCPT ); Mon, 17 Sep 2007 19:36:22 -0400 Received: from pentafluge.infradead.org ([213.146.154.40]:59430 "EHLO pentafluge.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755118AbXIQXgV (ORCPT ); Mon, 17 Sep 2007 19:36:21 -0400 Subject: Re: [PATCH] modpost: detect unterminated device id lists From: Mauro Carvalho Chehab To: Andrew Morton Cc: Satyam Sharma , Satyam Sharma , Kees Cook , Greg KH , Alexey Dobriyan , Jeff Garzik , linux-kernel@vger.kernel.org, Ben Collins , Michael Wu In-Reply-To: <20070917145029.26370d6f.akpm@linux-foundation.org> References: <20070912064134.GO7910@outflux.net> <46E7C91D.3070001@garzik.org> <20070912215356.GC23294@kroah.com> <20070913004937.GM8183@outflux.net> <20070916151447.dc925a9e.akpm@linux-foundation.org> <20070916234657.6548efe3.akpm@linux-foundation.org> <20070917145029.26370d6f.akpm@linux-foundation.org> Content-Type: text/plain; charset=UTF-8 Date: Mon, 17 Sep 2007 20:36:48 -0300 Message-Id: <1190072208.6281.31.camel@areia> Mime-Version: 1.0 X-Mailer: Evolution 2.11.91-1mdv2008.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by pentafluge.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3580 Lines: 95 Hi Andrew, Em Seg, 2007-09-17 às 14:50 -0700, Andrew Morton escreveu: > On Tue, 18 Sep 2007 03:15:14 +0530 (IST) > Satyam Sharma wrote: > > > > > > > On Sun, 16 Sep 2007, Andrew Morton wrote: > > > > > On Mon, 17 Sep 2007 05:54:45 +0530 "Satyam Sharma" wrote: > > > > > > > On 9/17/07, Andrew Morton wrote: > > > > > > > > > > I'm getting this: > > > > > > > > > > rusb2/pvrusb2: struct usb_device_id is 20 bytes. The last of 3 is: > > > > > 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 > > > > > 0x00 0x00 0x00 0x00 0x00 > > > > > FATAL: drivers/media/video/pvrusb2/pvrusb2: struct usb_device_id is not terminated > > > > > with a NULL entry! > > > > > > > > > > ("rusb2/pvrusb2" ??) > > > > > > > > Hmm? Are you sure you didn't see any "drivers/media/video/pv" before the > > > > "rusb2/pvrusb2" bit? > > > > > > Fairly. I looked twice. > > > > "drivers/media/video/pvrusb2/pvrusb2" comes out correctly here ... > > > > > > > > Looking at Kees' patch (and the existing code), I've no > > > > clue how/why this should happen ... will try to reproduce here ... > > > > > > > > > > > > > but: > > > > > > > > > > struct usb_device_id pvr2_device_table[] = { > > > > > [PVR2_HDW_TYPE_29XXX] = { USB_DEVICE(0x2040, 0x2900) }, > > > > > [PVR2_HDW_TYPE_24XXX] = { USB_DEVICE(0x2040, 0x2400) }, > > > > > { USB_DEVICE(0, 0) }, > > > > > }; > > > > > > > > > > looks OK? > > > > > > > > > > Using plain old "{ }" shut the warning up. > > > > > > > > USB_DEVICE(0, 0) is not empty termination, actually, and this looks like > > > > a genuine bug caught by the patch. As that dump shows, USB_DEVICE(0, 0) > > > > assigns "0x03 0x00" (in little endian) to usb_device_id.match_flags. And > > > > I don't think the USB code treats such an entry as an empty entry (?) > > > > > > > > Interestingly, the "USB_DEVICE(0, 0)" thing is absent from latest -git > > > > tree and also in my copy of 23-rc4-mm1 -- so this looks like something > > > > you must've merged recently. > > > > > > git-dvb very carefully does > > > > > > --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c~git-dvb > > > +++ a/drivers/media/video/pvrusb2/pvrusb2-hdw.c > > > @@ -44,7 +44,7 @@ > > > struct usb_device_id pvr2_device_table[] = { > > > [PVR2_HDW_TYPE_29XXX] = { USB_DEVICE(0x2040, 0x2900) }, > > > [PVR2_HDW_TYPE_24XXX] = { USB_DEVICE(0x2040, 0x2400) }, > > > - { } > > > + { USB_DEVICE(0, 0) }, > > > }; > > > > > > MODULE_DEVICE_TABLE(usb, pvr2_device_table); > > > > Ok, this is a false positive indeed, the core USB code does in fact > > treat such an entry as an empty entry (usb_match_id() tests only the > > .idVendor, .bDeviceClass, .bInterfaceClass and .driver_info members > > for non-zero and not the .match_flags member). > > > > However, a quick-grep-and-glance tells us that none of the other 2213 > > occurrences of USB_DEVICE() in the tree ever do this "(0,0)" thing, > > so it does make sense to change this one to a simple "{ }" as well -- > > that's clearer style anyway, and the "standard" way to empty-terminate > > in the rest of the tree, if nothing else. > > > > yeah, I think so. Mauro, could you please drop that change? Patch dropped from my tree. Cheers, Mauro. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/