Re: [PATCH v11 18/19] module: fix types of device tables aliases

2015-02-16 Thread Andrey Ryabinin
On 02/16/2015 05:44 AM, Rusty Russell wrote:
> Andrey Ryabinin  writes:
>> MODULE_DEVICE_TABLE() macro used to create aliases to device tables.
>> Normally alias should have the same type as aliased symbol.
>>
>> Device tables are arrays, so they have 'struct type##_device_id[x]'
>> types. Alias created by MODULE_DEVICE_TABLE() will have non-array type -
>>  'struct type##_device_id'.
>>
>> This inconsistency confuses compiler, it could make a wrong
>> assumption about variable's size which leads KASan to
>> produce a false positive report about out of bounds access.
> 
> Hmm, as Andrew Morton points out, this breaks some usage; if we just
> fix the type (struct type##_device_id[]) will that work instead?
> 
> I'm guessing not, since typeof(x) will presumably preserve sizing
> information?
> 

Yes, this won't work.
In this particular case 'struct type##_device_id[]' would be equivalent
to 'struct type##_device_id[1]'

$ cat test.c
struct d {
int a;
int b;
};
struct d arr[] = {
{1, 2}, {3, 4}, {}
};
extern struct d arr_alias[] __attribute__((alias("arr")));

$ gcc -c test.c
test.c:8:17: warning: array ‘arr_alias’ assumed to have one element
 extern struct d arr_alias[] __attribute__((alias("arr")));

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v11 18/19] module: fix types of device tables aliases

2015-02-16 Thread Andrey Ryabinin
On 02/16/2015 05:44 AM, Rusty Russell wrote:
 Andrey Ryabinin a.ryabi...@samsung.com writes:
 MODULE_DEVICE_TABLE() macro used to create aliases to device tables.
 Normally alias should have the same type as aliased symbol.

 Device tables are arrays, so they have 'struct type##_device_id[x]'
 types. Alias created by MODULE_DEVICE_TABLE() will have non-array type -
  'struct type##_device_id'.

 This inconsistency confuses compiler, it could make a wrong
 assumption about variable's size which leads KASan to
 produce a false positive report about out of bounds access.
 
 Hmm, as Andrew Morton points out, this breaks some usage; if we just
 fix the type (struct type##_device_id[]) will that work instead?
 
 I'm guessing not, since typeof(x) will presumably preserve sizing
 information?
 

Yes, this won't work.
In this particular case 'struct type##_device_id[]' would be equivalent
to 'struct type##_device_id[1]'

$ cat test.c
struct d {
int a;
int b;
};
struct d arr[] = {
{1, 2}, {3, 4}, {}
};
extern struct d arr_alias[] __attribute__((alias(arr)));

$ gcc -c test.c
test.c:8:17: warning: array ‘arr_alias’ assumed to have one element
 extern struct d arr_alias[] __attribute__((alias(arr)));

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v11 18/19] module: fix types of device tables aliases

2015-02-15 Thread Rusty Russell
Andrey Ryabinin  writes:
> MODULE_DEVICE_TABLE() macro used to create aliases to device tables.
> Normally alias should have the same type as aliased symbol.
>
> Device tables are arrays, so they have 'struct type##_device_id[x]'
> types. Alias created by MODULE_DEVICE_TABLE() will have non-array type -
>   'struct type##_device_id'.
>
> This inconsistency confuses compiler, it could make a wrong
> assumption about variable's size which leads KASan to
> produce a false positive report about out of bounds access.

Hmm, as Andrew Morton points out, this breaks some usage; if we just
fix the type (struct type##_device_id[]) will that work instead?

I'm guessing not, since typeof(x) will presumably preserve sizing
information?

Cheers,
Rusty.

>
> For every global variable compiler calls __asan_register_globals()
> passing information about global variable (address, size, size with
> redzone, name ...) __asan_register_globals() poison symbols
> redzone to detect possible out of bounds accesses.
>
> When symbol has an alias __asan_register_globals() will be called
> as for symbol so for alias. Compiler determines size of variable by
> size of variable's type. Alias and symbol have the same address,
> so if alias have the wrong size part of memory that actually belongs
> to the symbol could be poisoned as redzone of alias symbol.
>
> By fixing type of alias symbol we will fix size of it, so
> __asan_register_globals() will not poison valid memory.
>
> Signed-off-by: Andrey Ryabinin 
> ---
>  include/linux/module.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/module.h b/include/linux/module.h
> index b653d7c..42999fe 100644
> --- a/include/linux/module.h
> +++ b/include/linux/module.h
> @@ -135,7 +135,7 @@ void trim_init_extable(struct module *m);
>  #ifdef MODULE
>  /* Creates an alias so file2alias.c can find device table. */
>  #define MODULE_DEVICE_TABLE(type, name)  
> \
> -  extern const struct type##_device_id __mod_##type##__##name##_device_table 
> \
> +extern const typeof(name) __mod_##type##__##name##_device_table  
> \
>__attribute__ ((unused, alias(__stringify(name
>  #else  /* !MODULE */
>  #define MODULE_DEVICE_TABLE(type, name)
> -- 
> 2.2.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v11 18/19] module: fix types of device tables aliases

2015-02-15 Thread Rusty Russell
Andrey Ryabinin a.ryabi...@samsung.com writes:
 MODULE_DEVICE_TABLE() macro used to create aliases to device tables.
 Normally alias should have the same type as aliased symbol.

 Device tables are arrays, so they have 'struct type##_device_id[x]'
 types. Alias created by MODULE_DEVICE_TABLE() will have non-array type -
   'struct type##_device_id'.

 This inconsistency confuses compiler, it could make a wrong
 assumption about variable's size which leads KASan to
 produce a false positive report about out of bounds access.

Hmm, as Andrew Morton points out, this breaks some usage; if we just
fix the type (struct type##_device_id[]) will that work instead?

I'm guessing not, since typeof(x) will presumably preserve sizing
information?

Cheers,
Rusty.


 For every global variable compiler calls __asan_register_globals()
 passing information about global variable (address, size, size with
 redzone, name ...) __asan_register_globals() poison symbols
 redzone to detect possible out of bounds accesses.

 When symbol has an alias __asan_register_globals() will be called
 as for symbol so for alias. Compiler determines size of variable by
 size of variable's type. Alias and symbol have the same address,
 so if alias have the wrong size part of memory that actually belongs
 to the symbol could be poisoned as redzone of alias symbol.

 By fixing type of alias symbol we will fix size of it, so
 __asan_register_globals() will not poison valid memory.

 Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com
 ---
  include/linux/module.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/include/linux/module.h b/include/linux/module.h
 index b653d7c..42999fe 100644
 --- a/include/linux/module.h
 +++ b/include/linux/module.h
 @@ -135,7 +135,7 @@ void trim_init_extable(struct module *m);
  #ifdef MODULE
  /* Creates an alias so file2alias.c can find device table. */
  #define MODULE_DEVICE_TABLE(type, name)  
 \
 -  extern const struct type##_device_id __mod_##type##__##name##_device_table 
 \
 +extern const typeof(name) __mod_##type##__##name##_device_table  
 \
__attribute__ ((unused, alias(__stringify(name
  #else  /* !MODULE */
  #define MODULE_DEVICE_TABLE(type, name)
 -- 
 2.2.2
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v11 18/19] module: fix types of device tables aliases

2015-02-03 Thread Andrew Morton
On Tue, 03 Feb 2015 19:01:08 -0500 Sasha Levin  wrote:

> > diff -puN 
> > drivers/scsi/be2iscsi/be_main.c~module_device_table-fix-some-callsites 
> > drivers/scsi/be2iscsi/be_main.c
> > --- a/drivers/scsi/be2iscsi/be_main.c~module_device_table-fix-some-callsites
> > +++ a/drivers/scsi/be2iscsi/be_main.c
> > @@ -48,7 +48,6 @@ static unsigned int be_iopoll_budget = 1
> >  static unsigned int be_max_phys_size = 64;
> >  static unsigned int enable_msix = 1;
> >  
> > -MODULE_DEVICE_TABLE(pci, beiscsi_pci_id_table);
> >  MODULE_DESCRIPTION(DRV_DESC " " BUILD_STR);
> >  MODULE_VERSION(BUILD_STR);
> >  MODULE_AUTHOR("Emulex Corporation");
> 
> This just removes MODULE_DEVICE_TABLE() rather than moving it to after the
> definition of beiscsi_pci_id_table.

There's already a MODULE_DEVICE_TABLE() after the beiscsi_pci_id_table
definition. 

drivers/net/ethernet/emulex/benet/be_main.c did the same thing. 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v11 18/19] module: fix types of device tables aliases

2015-02-03 Thread Sasha Levin
On 02/03/2015 06:51 PM, Andrew Morton wrote:
> From: Andrew Morton 
> Subject: MODULE_DEVICE_TABLE: fix some callsites
> 
> The patch "module: fix types of device tables aliases" newly requires that
> invokations of
  invocations
> 
> MODULE_DEVICE_TABLE(type, name);
> 
> come *after* the definition of `name'.  That is reasonable, but some
> drivers weren't doing this.  Fix them.
> 
> Cc: James Bottomley 
> Cc: Andrey Ryabinin 
> Signed-off-by: Andrew Morton 
> ---
> 
>  drivers/scsi/be2iscsi/be_main.c |1 -
>  1 file changed, 1 deletion(-)
> 
> diff -puN 
> drivers/scsi/be2iscsi/be_main.c~module_device_table-fix-some-callsites 
> drivers/scsi/be2iscsi/be_main.c
> --- a/drivers/scsi/be2iscsi/be_main.c~module_device_table-fix-some-callsites
> +++ a/drivers/scsi/be2iscsi/be_main.c
> @@ -48,7 +48,6 @@ static unsigned int be_iopoll_budget = 1
>  static unsigned int be_max_phys_size = 64;
>  static unsigned int enable_msix = 1;
>  
> -MODULE_DEVICE_TABLE(pci, beiscsi_pci_id_table);
>  MODULE_DESCRIPTION(DRV_DESC " " BUILD_STR);
>  MODULE_VERSION(BUILD_STR);
>  MODULE_AUTHOR("Emulex Corporation");

This just removes MODULE_DEVICE_TABLE() rather than moving it to after the
definition of beiscsi_pci_id_table.


Thanks,
Sasha
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v11 18/19] module: fix types of device tables aliases

2015-02-03 Thread Andrew Morton
On Tue, 03 Feb 2015 20:43:11 +0300 Andrey Ryabinin  
wrote:

> MODULE_DEVICE_TABLE() macro used to create aliases to device tables.
> Normally alias should have the same type as aliased symbol.
> 
> Device tables are arrays, so they have 'struct type##_device_id[x]'
> types. Alias created by MODULE_DEVICE_TABLE() will have non-array type -
>   'struct type##_device_id'.
> 
> This inconsistency confuses compiler, it could make a wrong
> assumption about variable's size which leads KASan to
> produce a false positive report about out of bounds access.
> 
> For every global variable compiler calls __asan_register_globals()
> passing information about global variable (address, size, size with
> redzone, name ...) __asan_register_globals() poison symbols
> redzone to detect possible out of bounds accesses.
> 
> When symbol has an alias __asan_register_globals() will be called
> as for symbol so for alias. Compiler determines size of variable by
> size of variable's type. Alias and symbol have the same address,
> so if alias have the wrong size part of memory that actually belongs
> to the symbol could be poisoned as redzone of alias symbol.
> 
> By fixing type of alias symbol we will fix size of it, so
> __asan_register_globals() will not poison valid memory.
> 
> ...
>
> --- a/include/linux/module.h
> +++ b/include/linux/module.h
> @@ -135,7 +135,7 @@ void trim_init_extable(struct module *m);
>  #ifdef MODULE
>  /* Creates an alias so file2alias.c can find device table. */
>  #define MODULE_DEVICE_TABLE(type, name)  
> \
> -  extern const struct type##_device_id __mod_##type##__##name##_device_table 
> \
> +extern const typeof(name) __mod_##type##__##name##_device_table  
> \
>__attribute__ ((unused, alias(__stringify(name
>  #else  /* !MODULE */
>  #define MODULE_DEVICE_TABLE(type, name)

This newly requires that `name' has been defined at the
MODULE_DEVICE_TABLE expansion site.

So drivers/scsi/be2iscsi/be_main.c explodes because we converted

extern const struct pci_device_id __mod_pci__beiscsi_pci_id_table_device_table 
__attribute__ ((unused, alias("beiscsi_pci_id_table")));

into

extern const typeof(beiscsi_pci_id_table) 
__mod_pci__beiscsi_pci_id_table_device_table __attribute__ ((unused, 
alias("beiscsi_pci_id_table")));

before beiscsi_pci_id_table was defined.


There are probably others, so I'll start accumulating the fixes.



From: Andrew Morton 
Subject: MODULE_DEVICE_TABLE: fix some callsites

The patch "module: fix types of device tables aliases" newly requires that
invokations of

MODULE_DEVICE_TABLE(type, name);

come *after* the definition of `name'.  That is reasonable, but some
drivers weren't doing this.  Fix them.

Cc: James Bottomley 
Cc: Andrey Ryabinin 
Signed-off-by: Andrew Morton 
---

 drivers/scsi/be2iscsi/be_main.c |1 -
 1 file changed, 1 deletion(-)

diff -puN 
drivers/scsi/be2iscsi/be_main.c~module_device_table-fix-some-callsites 
drivers/scsi/be2iscsi/be_main.c
--- a/drivers/scsi/be2iscsi/be_main.c~module_device_table-fix-some-callsites
+++ a/drivers/scsi/be2iscsi/be_main.c
@@ -48,7 +48,6 @@ static unsigned int be_iopoll_budget = 1
 static unsigned int be_max_phys_size = 64;
 static unsigned int enable_msix = 1;
 
-MODULE_DEVICE_TABLE(pci, beiscsi_pci_id_table);
 MODULE_DESCRIPTION(DRV_DESC " " BUILD_STR);
 MODULE_VERSION(BUILD_STR);
 MODULE_AUTHOR("Emulex Corporation");
_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v11 18/19] module: fix types of device tables aliases

2015-02-03 Thread Andrey Ryabinin
MODULE_DEVICE_TABLE() macro used to create aliases to device tables.
Normally alias should have the same type as aliased symbol.

Device tables are arrays, so they have 'struct type##_device_id[x]'
types. Alias created by MODULE_DEVICE_TABLE() will have non-array type -
'struct type##_device_id'.

This inconsistency confuses compiler, it could make a wrong
assumption about variable's size which leads KASan to
produce a false positive report about out of bounds access.

For every global variable compiler calls __asan_register_globals()
passing information about global variable (address, size, size with
redzone, name ...) __asan_register_globals() poison symbols
redzone to detect possible out of bounds accesses.

When symbol has an alias __asan_register_globals() will be called
as for symbol so for alias. Compiler determines size of variable by
size of variable's type. Alias and symbol have the same address,
so if alias have the wrong size part of memory that actually belongs
to the symbol could be poisoned as redzone of alias symbol.

By fixing type of alias symbol we will fix size of it, so
__asan_register_globals() will not poison valid memory.

Signed-off-by: Andrey Ryabinin 
---
 include/linux/module.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/module.h b/include/linux/module.h
index b653d7c..42999fe 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -135,7 +135,7 @@ void trim_init_extable(struct module *m);
 #ifdef MODULE
 /* Creates an alias so file2alias.c can find device table. */
 #define MODULE_DEVICE_TABLE(type, name)
\
-  extern const struct type##_device_id __mod_##type##__##name##_device_table \
+extern const typeof(name) __mod_##type##__##name##_device_table
\
   __attribute__ ((unused, alias(__stringify(name
 #else  /* !MODULE */
 #define MODULE_DEVICE_TABLE(type, name)
-- 
2.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v11 18/19] module: fix types of device tables aliases

2015-02-03 Thread Andrey Ryabinin
MODULE_DEVICE_TABLE() macro used to create aliases to device tables.
Normally alias should have the same type as aliased symbol.

Device tables are arrays, so they have 'struct type##_device_id[x]'
types. Alias created by MODULE_DEVICE_TABLE() will have non-array type -
'struct type##_device_id'.

This inconsistency confuses compiler, it could make a wrong
assumption about variable's size which leads KASan to
produce a false positive report about out of bounds access.

For every global variable compiler calls __asan_register_globals()
passing information about global variable (address, size, size with
redzone, name ...) __asan_register_globals() poison symbols
redzone to detect possible out of bounds accesses.

When symbol has an alias __asan_register_globals() will be called
as for symbol so for alias. Compiler determines size of variable by
size of variable's type. Alias and symbol have the same address,
so if alias have the wrong size part of memory that actually belongs
to the symbol could be poisoned as redzone of alias symbol.

By fixing type of alias symbol we will fix size of it, so
__asan_register_globals() will not poison valid memory.

Signed-off-by: Andrey Ryabinin a.ryabi...@samsung.com
---
 include/linux/module.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/module.h b/include/linux/module.h
index b653d7c..42999fe 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -135,7 +135,7 @@ void trim_init_extable(struct module *m);
 #ifdef MODULE
 /* Creates an alias so file2alias.c can find device table. */
 #define MODULE_DEVICE_TABLE(type, name)
\
-  extern const struct type##_device_id __mod_##type##__##name##_device_table \
+extern const typeof(name) __mod_##type##__##name##_device_table
\
   __attribute__ ((unused, alias(__stringify(name
 #else  /* !MODULE */
 #define MODULE_DEVICE_TABLE(type, name)
-- 
2.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v11 18/19] module: fix types of device tables aliases

2015-02-03 Thread Andrew Morton
On Tue, 03 Feb 2015 20:43:11 +0300 Andrey Ryabinin a.ryabi...@samsung.com 
wrote:

 MODULE_DEVICE_TABLE() macro used to create aliases to device tables.
 Normally alias should have the same type as aliased symbol.
 
 Device tables are arrays, so they have 'struct type##_device_id[x]'
 types. Alias created by MODULE_DEVICE_TABLE() will have non-array type -
   'struct type##_device_id'.
 
 This inconsistency confuses compiler, it could make a wrong
 assumption about variable's size which leads KASan to
 produce a false positive report about out of bounds access.
 
 For every global variable compiler calls __asan_register_globals()
 passing information about global variable (address, size, size with
 redzone, name ...) __asan_register_globals() poison symbols
 redzone to detect possible out of bounds accesses.
 
 When symbol has an alias __asan_register_globals() will be called
 as for symbol so for alias. Compiler determines size of variable by
 size of variable's type. Alias and symbol have the same address,
 so if alias have the wrong size part of memory that actually belongs
 to the symbol could be poisoned as redzone of alias symbol.
 
 By fixing type of alias symbol we will fix size of it, so
 __asan_register_globals() will not poison valid memory.
 
 ...

 --- a/include/linux/module.h
 +++ b/include/linux/module.h
 @@ -135,7 +135,7 @@ void trim_init_extable(struct module *m);
  #ifdef MODULE
  /* Creates an alias so file2alias.c can find device table. */
  #define MODULE_DEVICE_TABLE(type, name)  
 \
 -  extern const struct type##_device_id __mod_##type##__##name##_device_table 
 \
 +extern const typeof(name) __mod_##type##__##name##_device_table  
 \
__attribute__ ((unused, alias(__stringify(name
  #else  /* !MODULE */
  #define MODULE_DEVICE_TABLE(type, name)

This newly requires that `name' has been defined at the
MODULE_DEVICE_TABLE expansion site.

So drivers/scsi/be2iscsi/be_main.c explodes because we converted

extern const struct pci_device_id __mod_pci__beiscsi_pci_id_table_device_table 
__attribute__ ((unused, alias(beiscsi_pci_id_table)));

into

extern const typeof(beiscsi_pci_id_table) 
__mod_pci__beiscsi_pci_id_table_device_table __attribute__ ((unused, 
alias(beiscsi_pci_id_table)));

before beiscsi_pci_id_table was defined.


There are probably others, so I'll start accumulating the fixes.



From: Andrew Morton a...@linux-foundation.org
Subject: MODULE_DEVICE_TABLE: fix some callsites

The patch module: fix types of device tables aliases newly requires that
invokations of

MODULE_DEVICE_TABLE(type, name);

come *after* the definition of `name'.  That is reasonable, but some
drivers weren't doing this.  Fix them.

Cc: James Bottomley james.bottom...@hansenpartnership.com
Cc: Andrey Ryabinin a.ryabi...@samsung.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/scsi/be2iscsi/be_main.c |1 -
 1 file changed, 1 deletion(-)

diff -puN 
drivers/scsi/be2iscsi/be_main.c~module_device_table-fix-some-callsites 
drivers/scsi/be2iscsi/be_main.c
--- a/drivers/scsi/be2iscsi/be_main.c~module_device_table-fix-some-callsites
+++ a/drivers/scsi/be2iscsi/be_main.c
@@ -48,7 +48,6 @@ static unsigned int be_iopoll_budget = 1
 static unsigned int be_max_phys_size = 64;
 static unsigned int enable_msix = 1;
 
-MODULE_DEVICE_TABLE(pci, beiscsi_pci_id_table);
 MODULE_DESCRIPTION(DRV_DESC   BUILD_STR);
 MODULE_VERSION(BUILD_STR);
 MODULE_AUTHOR(Emulex Corporation);
_

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v11 18/19] module: fix types of device tables aliases

2015-02-03 Thread Sasha Levin
On 02/03/2015 06:51 PM, Andrew Morton wrote:
 From: Andrew Morton a...@linux-foundation.org
 Subject: MODULE_DEVICE_TABLE: fix some callsites
 
 The patch module: fix types of device tables aliases newly requires that
 invokations of
  invocations
 
 MODULE_DEVICE_TABLE(type, name);
 
 come *after* the definition of `name'.  That is reasonable, but some
 drivers weren't doing this.  Fix them.
 
 Cc: James Bottomley james.bottom...@hansenpartnership.com
 Cc: Andrey Ryabinin a.ryabi...@samsung.com
 Signed-off-by: Andrew Morton a...@linux-foundation.org
 ---
 
  drivers/scsi/be2iscsi/be_main.c |1 -
  1 file changed, 1 deletion(-)
 
 diff -puN 
 drivers/scsi/be2iscsi/be_main.c~module_device_table-fix-some-callsites 
 drivers/scsi/be2iscsi/be_main.c
 --- a/drivers/scsi/be2iscsi/be_main.c~module_device_table-fix-some-callsites
 +++ a/drivers/scsi/be2iscsi/be_main.c
 @@ -48,7 +48,6 @@ static unsigned int be_iopoll_budget = 1
  static unsigned int be_max_phys_size = 64;
  static unsigned int enable_msix = 1;
  
 -MODULE_DEVICE_TABLE(pci, beiscsi_pci_id_table);
  MODULE_DESCRIPTION(DRV_DESC   BUILD_STR);
  MODULE_VERSION(BUILD_STR);
  MODULE_AUTHOR(Emulex Corporation);

This just removes MODULE_DEVICE_TABLE() rather than moving it to after the
definition of beiscsi_pci_id_table.


Thanks,
Sasha
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v11 18/19] module: fix types of device tables aliases

2015-02-03 Thread Andrew Morton
On Tue, 03 Feb 2015 19:01:08 -0500 Sasha Levin sasha.le...@oracle.com wrote:

  diff -puN 
  drivers/scsi/be2iscsi/be_main.c~module_device_table-fix-some-callsites 
  drivers/scsi/be2iscsi/be_main.c
  --- a/drivers/scsi/be2iscsi/be_main.c~module_device_table-fix-some-callsites
  +++ a/drivers/scsi/be2iscsi/be_main.c
  @@ -48,7 +48,6 @@ static unsigned int be_iopoll_budget = 1
   static unsigned int be_max_phys_size = 64;
   static unsigned int enable_msix = 1;
   
  -MODULE_DEVICE_TABLE(pci, beiscsi_pci_id_table);
   MODULE_DESCRIPTION(DRV_DESC   BUILD_STR);
   MODULE_VERSION(BUILD_STR);
   MODULE_AUTHOR(Emulex Corporation);
 
 This just removes MODULE_DEVICE_TABLE() rather than moving it to after the
 definition of beiscsi_pci_id_table.

There's already a MODULE_DEVICE_TABLE() after the beiscsi_pci_id_table
definition. 

drivers/net/ethernet/emulex/benet/be_main.c did the same thing. 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/