Linux Media Controller development
 help / color / mirror / Atom feed
* Re: [PATCH 4/6] dvb/dvb-usb: prepare for FIRMWARE_NAME_MAX removal
       [not found] ` <20090526174213.806710164@linux.intel.com>
@ 2009-05-26 18:32   ` Michael Krufky
  2009-05-26 18:42     ` Samuel Ortiz
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Krufky @ 2009-05-26 18:32 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: linux-kernel, Greg Kroah-Hartmann, Mauro Carvalho Chehab,
	Kay Sievers, linux-media

On Tue, May 26, 2009 at 1:40 PM, Samuel Ortiz <sameo@linux.intel.com> wrote:
> From: Samuel Ortiz <sameo@linux.intel.com>
> To: Mauro Carvalho Chehab <mchehab@infradead.org>
>
> We're going to remove the FIRMWARE_NAME_MAX definition in order to avoid any
> firmware name length restriction.
> This patch changes the dvb_usb_device_properties firmware field accordingly.
>
> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
>
> ---
>  drivers/media/dvb/dvb-usb/dvb-usb.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: iwm-2.6/drivers/media/dvb/dvb-usb/dvb-usb.h
> ===================================================================
> --- iwm-2.6.orig/drivers/media/dvb/dvb-usb/dvb-usb.h    2009-05-26 17:24:36.000000000 +0200
> +++ iwm-2.6/drivers/media/dvb/dvb-usb/dvb-usb.h 2009-05-26 17:25:19.000000000 +0200
> @@ -196,7 +196,7 @@ struct dvb_usb_device_properties {
>  #define CYPRESS_FX2     3
>        int        usb_ctrl;
>        int        (*download_firmware) (struct usb_device *, const struct firmware *);
> -       const char firmware[FIRMWARE_NAME_MAX];
> +       const char *firmware;
>        int        no_reconnect;
>
>        int size_of_priv;
>
> --
> Intel Open Source Technology Centre
> http://oss.intel.com/
> --
> 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/
>

Samuel,

Your patch makes the following change:

-       const char firmware[FIRMWARE_NAME_MAX];
+       const char *firmware;

Before your change, struct dvb_usb_device_properties actually contains
memory allocated for the firmware filename.  After your change, this
is nothing but a pointer.

This will cause an OOPS.

Regards,

Mike Krufky

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 4/6] dvb/dvb-usb: prepare for FIRMWARE_NAME_MAX removal
  2009-05-26 18:32   ` [PATCH 4/6] dvb/dvb-usb: prepare for FIRMWARE_NAME_MAX removal Michael Krufky
@ 2009-05-26 18:42     ` Samuel Ortiz
  2009-05-26 18:44       ` Michael Krufky
  0 siblings, 1 reply; 3+ messages in thread
From: Samuel Ortiz @ 2009-05-26 18:42 UTC (permalink / raw)
  To: Michael Krufky
  Cc: linux-kernel, Greg Kroah-Hartmann, Mauro Carvalho Chehab,
	Kay Sievers, linux-media

On Tue, May 26, 2009 at 02:32:45PM -0400, Michael Krufky wrote:
> On Tue, May 26, 2009 at 1:40 PM, Samuel Ortiz <sameo@linux.intel.com> wrote:
> > From: Samuel Ortiz <sameo@linux.intel.com>
> > To: Mauro Carvalho Chehab <mchehab@infradead.org>
> >
> > We're going to remove the FIRMWARE_NAME_MAX definition in order to avoid any
> > firmware name length restriction.
> > This patch changes the dvb_usb_device_properties firmware field accordingly.
> >
> > Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
> >
> > ---
> >  drivers/media/dvb/dvb-usb/dvb-usb.h |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > Index: iwm-2.6/drivers/media/dvb/dvb-usb/dvb-usb.h
> > ===================================================================
> > --- iwm-2.6.orig/drivers/media/dvb/dvb-usb/dvb-usb.h    2009-05-26 17:24:36.000000000 +0200
> > +++ iwm-2.6/drivers/media/dvb/dvb-usb/dvb-usb.h 2009-05-26 17:25:19.000000000 +0200
> > @@ -196,7 +196,7 @@ struct dvb_usb_device_properties {
> >  #define CYPRESS_FX2     3
> >        int        usb_ctrl;
> >        int        (*download_firmware) (struct usb_device *, const struct firmware *);
> > -       const char firmware[FIRMWARE_NAME_MAX];
> > +       const char *firmware;
> >        int        no_reconnect;
> >
> >        int size_of_priv;
> >
> > --
> > Intel Open Source Technology Centre
> > http://oss.intel.com/
> > --
> > 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/
> >
> 
> Samuel,
> 
> Your patch makes the following change:
> 
> -       const char firmware[FIRMWARE_NAME_MAX];
> +       const char *firmware;
> 
> Before your change, struct dvb_usb_device_properties actually contains
> memory allocated for the firmware filename.  After your change, this
> is nothing but a pointer.
> 
> This will cause an OOPS.
No, not if it's correctly initialized, as it seems to be for all the
dvb_usb_device_properties users right now.
Typically, you'd initialize your dvb_usb_device_properties like this:

static struct dvb_usb_device_properties a800_properties = {
        .caps = DVB_USB_IS_AN_I2C_ADAPTER,

        .usb_ctrl = CYPRESS_FX2,
        .firmware = "dvb-usb-avertv-a800-02.fw",
[...]

And that's fine.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 4/6] dvb/dvb-usb: prepare for FIRMWARE_NAME_MAX removal
  2009-05-26 18:42     ` Samuel Ortiz
@ 2009-05-26 18:44       ` Michael Krufky
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Krufky @ 2009-05-26 18:44 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: linux-kernel, Greg Kroah-Hartmann, Mauro Carvalho Chehab,
	Kay Sievers, linux-media

On Tue, May 26, 2009 at 2:42 PM, Samuel Ortiz <sameo@linux.intel.com> wrote:
> On Tue, May 26, 2009 at 02:32:45PM -0400, Michael Krufky wrote:
>> On Tue, May 26, 2009 at 1:40 PM, Samuel Ortiz <sameo@linux.intel.com> wrote:
>> > From: Samuel Ortiz <sameo@linux.intel.com>
>> > To: Mauro Carvalho Chehab <mchehab@infradead.org>
>> >
>> > We're going to remove the FIRMWARE_NAME_MAX definition in order to avoid any
>> > firmware name length restriction.
>> > This patch changes the dvb_usb_device_properties firmware field accordingly.
>> >
>> > Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
>> >
>> > ---
>> >  drivers/media/dvb/dvb-usb/dvb-usb.h |    2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > Index: iwm-2.6/drivers/media/dvb/dvb-usb/dvb-usb.h
>> > ===================================================================
>> > --- iwm-2.6.orig/drivers/media/dvb/dvb-usb/dvb-usb.h    2009-05-26 17:24:36.000000000 +0200
>> > +++ iwm-2.6/drivers/media/dvb/dvb-usb/dvb-usb.h 2009-05-26 17:25:19.000000000 +0200
>> > @@ -196,7 +196,7 @@ struct dvb_usb_device_properties {
>> >  #define CYPRESS_FX2     3
>> >        int        usb_ctrl;
>> >        int        (*download_firmware) (struct usb_device *, const struct firmware *);
>> > -       const char firmware[FIRMWARE_NAME_MAX];
>> > +       const char *firmware;
>> >        int        no_reconnect;
>> >
>> >        int size_of_priv;
>> >
>> > --
>> > Intel Open Source Technology Centre
>> > http://oss.intel.com/
>> > --
>> > 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/
>> >
>>
>> Samuel,
>>
>> Your patch makes the following change:
>>
>> -       const char firmware[FIRMWARE_NAME_MAX];
>> +       const char *firmware;
>>
>> Before your change, struct dvb_usb_device_properties actually contains
>> memory allocated for the firmware filename.  After your change, this
>> is nothing but a pointer.
>>
>> This will cause an OOPS.
> No, not if it's correctly initialized, as it seems to be for all the
> dvb_usb_device_properties users right now.
> Typically, you'd initialize your dvb_usb_device_properties like this:
>
> static struct dvb_usb_device_properties a800_properties = {
>        .caps = DVB_USB_IS_AN_I2C_ADAPTER,
>
>        .usb_ctrl = CYPRESS_FX2,
>        .firmware = "dvb-usb-avertv-a800-02.fw",
> [...]
>
> And that's fine.

You're right -- there is nothing wrong with the change -- my bad.

I traced though the code after posting that last mail.  It looked
risky when I just looked at the patch, but in the end this is actually
cleaner and much better.

Sorry for the noise.

Acked /
Reviewed-by: Michael Krufky <mkrufky@kernellabs.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-05-26 18:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20090526174012.423883376@linux.intel.com>
     [not found] ` <20090526174213.806710164@linux.intel.com>
2009-05-26 18:32   ` [PATCH 4/6] dvb/dvb-usb: prepare for FIRMWARE_NAME_MAX removal Michael Krufky
2009-05-26 18:42     ` Samuel Ortiz
2009-05-26 18:44       ` Michael Krufky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox