public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Satyam Sharma" <satyam.sharma@gmail.com>
Cc: "Kees Cook" <kees@ubuntu.com>, "Greg KH" <greg@kroah.com>,
	"Alexey Dobriyan" <adobriyan@gmail.com>,
	"Jeff Garzik" <jeff@garzik.org>,
	linux-kernel@vger.kernel.org, "Ben Collins" <bcollins@ubuntu.com>,
	"Michael Wu" <flamingice@sourmilk.net>
Subject: Re: [PATCH] modpost: detect unterminated device id lists
Date: Sun, 16 Sep 2007 23:46:57 -0700	[thread overview]
Message-ID: <20070916234657.6548efe3.akpm@linux-foundation.org> (raw)
In-Reply-To: <a781481a0709161724r6cf664e6q453331911cd0b493@mail.gmail.com>

On Mon, 17 Sep 2007 05:54:45 +0530 "Satyam Sharma" <satyam.sharma@gmail.com> wrote:

> On 9/17/07, Andrew Morton <akpm@linux-foundation.org> wrote:
> > On Wed, 12 Sep 2007 17:49:37 -0700 Kees Cook <kees@ubuntu.com> wrote:
> >
> > > This patch against 2.6.23-rc6 will cause modpost to fail if any device
> > > id lists are incorrectly terminated, after reporting the offender.
> >
> > 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.

> 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);
	

  reply	other threads:[~2007-09-17  6:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-12  6:41 [PATCH] pci: fix unterminated pci_device_id lists Kees Cook
2007-09-12 11:10 ` Jeff Garzik
2007-09-12 11:48   ` Alexey Dobriyan
2007-09-12 21:53     ` Greg KH
2007-09-12 23:08       ` Andrew Morton
2007-09-13  6:34         ` Alexey Dobriyan
2007-09-13  6:42           ` Jeff Garzik
2007-09-15  9:01             ` Jan Engelhardt
2007-09-13  6:58           ` Sam Ravnborg
2007-09-13  0:49       ` [PATCH] modpost: detect unterminated device id lists Kees Cook
2007-09-13  1:21         ` Andrew Morton
2007-09-16 22:14         ` Andrew Morton
2007-09-17  0:24           ` Satyam Sharma
2007-09-17  6:46             ` Andrew Morton [this message]
2007-09-17 21:45               ` Satyam Sharma
2007-09-17 21:50                 ` Andrew Morton
2007-09-17 23:36                   ` Mauro Carvalho Chehab
2007-09-17  1:22         ` Satyam Sharma
2007-09-17  3:45           ` Kees Cook
2007-09-17  6:48             ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070916234657.6548efe3.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=adobriyan@gmail.com \
    --cc=bcollins@ubuntu.com \
    --cc=flamingice@sourmilk.net \
    --cc=greg@kroah.com \
    --cc=jeff@garzik.org \
    --cc=kees@ubuntu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=satyam.sharma@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox