diff mbox series

block: Fix elevator name declaration

Message ID 20190710155741.11292-1-damien.lemoal@wdc.com (mailing list archive)
State New, archived
Headers show
Series block: Fix elevator name declaration | expand

Commit Message

Damien Le Moal July 10, 2019, 3:57 p.m. UTC
The elevator_name field in struct elevator_type is declared as an array
of characters (ELV_NAME_MAX size) but in practice used as a string
pointer with its initialization done statically within each
elevator elevator_type structure declaration.

Change the declaration of elevator_name to the more appropriate
"const char *" type.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 include/linux/elevator.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marcos Paulo de Souza July 10, 2019, 4:34 p.m. UTC | #1
On Thu, Jul 11, 2019 at 12:57:41AM +0900, Damien Le Moal wrote:
> The elevator_name field in struct elevator_type is declared as an array
> of characters (ELV_NAME_MAX size) but in practice used as a string
> pointer with its initialization done statically within each
> elevator elevator_type structure declaration.
> 
> Change the declaration of elevator_name to the more appropriate
> "const char *" type.
> 
> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
> ---
>  include/linux/elevator.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/elevator.h b/include/linux/elevator.h
> index 9842e53623f3..b73e6f35fbad 100644
> --- a/include/linux/elevator.h
> +++ b/include/linux/elevator.h
> @@ -75,7 +75,7 @@ struct elevator_type
>  	size_t icq_size;	/* see iocontext.h */
>  	size_t icq_align;	/* ditto */
>  	struct elv_fs_entry *elevator_attrs;
> -	char elevator_name[ELV_NAME_MAX];
> +	const char *elevator_name;
>  	const char *elevator_alias;
>  	struct module *elevator_owner;
>  #ifdef CONFIG_BLK_DEBUG_FS

Acked-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>

> -- 
> 2.21.0
>
Jens Axboe July 10, 2019, 8:06 p.m. UTC | #2
On 7/10/19 9:57 AM, Damien Le Moal wrote:
> The elevator_name field in struct elevator_type is declared as an array
> of characters (ELV_NAME_MAX size) but in practice used as a string
> pointer with its initialization done statically within each
> elevator elevator_type structure declaration.
> 
> Change the declaration of elevator_name to the more appropriate
> "const char *" type.

Applied, thanks.
diff mbox series

Patch

diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 9842e53623f3..b73e6f35fbad 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -75,7 +75,7 @@  struct elevator_type
 	size_t icq_size;	/* see iocontext.h */
 	size_t icq_align;	/* ditto */
 	struct elv_fs_entry *elevator_attrs;
-	char elevator_name[ELV_NAME_MAX];
+	const char *elevator_name;
 	const char *elevator_alias;
 	struct module *elevator_owner;
 #ifdef CONFIG_BLK_DEBUG_FS