All of lore.kernel.org
 help / color / mirror / Atom feed
* Question about module.[c,h] - kernel 2.4.18
@ 2002-05-12  0:33 Ron Gage
  2002-05-12  1:06 ` Keith Owens
  0 siblings, 1 reply; 2+ messages in thread
From: Ron Gage @ 2002-05-12  0:33 UTC (permalink / raw)
  To: linux-kernel

Hi folks:

I am in the process of doing some compile cleanups - a la kernel
janitors project type stuff.

I came across a fairly major inconsistancy in module.c and module.h and
I was hoping someone could tell me just how whacked my view of this
is...

The code in question from module.c...

struct module kernel_module =
{
        size_of_struct:         sizeof(struct module),
        name:                   "",
        uc:                     {ATOMIC_INIT(1)},
        flags:                  MOD_RUNNING,
        syms:                   __start___ksymtab,
        ex_table_start:         __start___ex_table,
        ex_table_end:           __stop___ex_table,
        kallsyms_start:         __start___kallsyms,
        kallsyms_end:           __stop___kallsyms,

};

Looks fairly straight forward, but it is missing several elements from
the module struct.  The module struct is defined as follows:

struct module
{
        unsigned long size_of_struct;   /* == sizeof(module) */
        struct module *next;
        const char *name;
        unsigned long size;

        union
        {
                atomic_t usecount;
                long pad;
        } uc;                           /* Needs to keep its size - so
says rth */

        unsigned long flags;            /* AUTOCLEAN et al */

        unsigned nsyms;
        unsigned ndeps;

        struct module_symbol *syms;
        struct module_ref *deps;
        struct module_ref *refs;
        int (*init)(void);
        void (*cleanup)(void);
        const struct exception_table_entry *ex_table_start;
        const struct exception_table_entry *ex_table_end;
#ifdef __alpha__
        unsigned long gp;
#endif
        /* Members past this point are extensions to the basic
           module support and are optional.  Use mod_member_present()
           to examine them.  */
        const struct module_persist *persist_start;
        const struct module_persist *persist_end;
        int (*can_unload)(void);
        int runsize;                    /* In modutils, not currently
used */
        const char *kallsyms_start;     /* All symbols for kernel
debugging */
        const char *kallsyms_end;
        const char *archdata_start;     /* arch specific data for module
*/
        const char *archdata_end;
        const char *kernel_data;        /* Reserved for kernel internal
use */
};


In essence, there are 20 elements to the module struct (i386), but
module.c only initializes 9 of those elements.  This gives 11
uninitialized elements (and compile warnings).  These warnings are what
I am trying to kill off.  

Does anyone see any problems with initializing the remaining elements of
this struct?

-- 
Ron Gage - Saginaw, MI
(ron@rongage.org)



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

* Re: Question about module.[c,h] - kernel 2.4.18
  2002-05-12  0:33 Question about module.[c,h] - kernel 2.4.18 Ron Gage
@ 2002-05-12  1:06 ` Keith Owens
  0 siblings, 0 replies; 2+ messages in thread
From: Keith Owens @ 2002-05-12  1:06 UTC (permalink / raw)
  To: Ron Gage; +Cc: linux-kernel

On 11 May 2002 20:33:09 -0400, 
Ron Gage <ron@rongage.org> wrote:
>I came across a fairly major inconsistancy in module.c and module.h and
>I was hoping someone could tell me just how whacked my view of this
>is...
>In essence, there are 20 elements to the module struct (i386), but
>module.c only initializes 9 of those elements.  This gives 11
>uninitialized elements (and compile warnings).  These warnings are what
>I am trying to kill off.  

struct module has static storage duration, all elements are
automatically set to 0 unless otherwise defined.

Which compiler is giving warnings?  If you are using a compiler that
requires all elements of a static storage variable be initialized then
it appears to be in violation of the C standard.

  6.7.8 Initialization

  19 The initialization shall occur in initializer list order, each
     initializer provided for a particular subobject overriding any
     previously listed initializer for the same subobject; all
     subobjects that are not initialized explicitly shall be
     initialized implicitly the same as objects that have static
     storage duration.

Static storage duration objects are set to 0.


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

end of thread, other threads:[~2002-05-12  1:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-12  0:33 Question about module.[c,h] - kernel 2.4.18 Ron Gage
2002-05-12  1:06 ` Keith Owens

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.