Patch: Rework of Device Driver Configuration

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Sep 10 12:41:40 UTC 2013


On 2013-09-10 13:26, Joel Sherrill wrote:
> I didn't want to do this much work but the device driver array and as declared as [] with no size. The maximum drivers was calculated as thr number of elements in the array. This left only the empty null slot at the end for dynamic drivers. If you had more than one dynamic driver, the array declaration was broken and overwrote adjacent memory.

Are you sure?  In _IO_Manager_initialization() the table is allocated from the 
workspace if necessary.  Is it possible to avoid this allocation now?

>
> Most of this patch makes it explicitly sized.
>
> It does not break all applications. It only impacts the few using dynamic drivers or application extra drivers. They will get a compile error indicating what to do.

Yes, it breaks the compilation.   I don't see what is so fundamentally wrong with

#define CONFIGURE_MAXIMUM_DRIVERS 123

It is good to have now the more explicit CONFIGURE_MAXIMUM_DYNAMIC_DRIVERS, but 
I don't think we should obsolete the CONFIGURE_MAXIMUM_DRIVERS.

>
> FWIW I suspect some of the tests with dynamic drivers were writing past the end of the driver array.
>
> It presents dynamic driver slot configuration in a more logical manner and fixes a serious bug.
>
> It is larger than I wanted but necessary and an improvement both logically and from a bug perspective. That's why I have been sitting on this and tweaking it so long.
>
> --jo
>
> Sebastian Huber <sebastian.huber at embedded-brains.de> wrote:
>
>
> On 2013-09-09 21:30, Joel Sherrill wrote:
>> +/**
>> + * The CONFIGURE_MAXIMUM_DRIVERS parameter is obsolete.
>> + * Users should use the CONFIGURE_MAXIMUM_DYNAMIC_DRIVERS
>> + * to specify the number of dynamically installed drivers.
>> + */
>> +#ifdef CONFIGURE_MAXIMUM_DRIVERS
>> +  #error "CONFIGURE_MAXIMUM_DRIVERS is obsolete. Use CONFIGURE_MAXIMUM_DYNAMIC_DRIVERS instead"
>> +#endif
>
> I wouldn't break all existing configurations this way.  I think its only an
> error if the application defines CONFIGURE_MAXIMUM_DRIVERS and
> CONFIGURE_MAXIMUM_DYNAMIC_DRIVERS at once.  It is also an error if
> CONFIGURE_MAXIMUM_DRIVERS < CONFIGURE_NUMBER_OF_STATIC_DRIVERS.
>
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax     : +49 89 189 47 41-09
> E-Mail  : sebastian.huber at embedded-brains.de
> PGP     : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>


-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list