Skip to contentSkip to conversation

drivers/parport/procfs.c:267:18-28: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) (fwd)

PATCH In review Julia Lawall 2 participants 2 messages Jul 19, 2023 – Jul 21, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 38/65 drivers/parport/procfs.c:267:18-28: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) (fwd)

Should device_dir be a flexible array?

julia

---------- Forwarded message ----------
Date: Wed, 19 Jul 2023 21:40:22 +0800
From: kernel test robot <[email protected]>
To: [email protected]
Cc: [email protected], Julia Lawall <[email protected]>
Subject: [joelgranados:jag/sysctl_remove_empty_elem 38/65]
drivers/parport/procfs.c:267:18-28: WARNING use flexible-array member instead
(https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-
and-one-element-arrays)

BCC: [email protected]
CC: [email protected]
TO: Joel Granados <[email protected]>

tree:   https://github.com/Joelgranados/linux.git jag/sysctl_remove_empty_elem
head:   a304fafc8514647e95ddf6cae2bdf2f7cd185ac1
commit: 03ff367f259166790e8982a17498c296193db2e5 [38/65] parport: rm sentinel element from ctl_table array

:::::: branch date: 22 hours ago
:::::: commit date: 23 hours ago
config: microblaze-randconfig-r062-20230717 (https://download.01.org/0day-ci/archive/20230719/[email protected]/config)
compiler: microblaze-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230719/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags

| Reported-by: kernel test robot <[email protected]>
| Reported-by: Julia Lawall <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

cocci warnings: (new ones prefixed by >>)

Quoted 1 line
Quoted 1 line

drivers/parport/procfs.c:267:18-28: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)

drivers/parport/procfs.c:364:18-28: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)

vim +267 drivers/parport/procfs.c

^1da177e4c3f41 Linus Torvalds 2005-04-16  257
^1da177e4c3f41 Linus Torvalds 2005-04-16  258
^1da177e4c3f41 Linus Torvalds 2005-04-16  259  struct parport_sysctl_table {
37e9981e33e4d3 Joel Granados  2023-06-16  260  	struct ctl_table_header *port_header;
37e9981e33e4d3 Joel Granados  2023-06-16  261  	struct ctl_table_header *devices_header;
03ff367f259166 Joel Granados  2023-06-27  262  #ifdef CONFIG_PARPORT_1284
03ff367f259166 Joel Granados  2023-06-27  263  	struct ctl_table vars[10];
03ff367f259166 Joel Granados  2023-06-27  264  #else
03ff367f259166 Joel Granados  2023-06-27  265  	struct ctl_table vars[5];
03ff367f259166 Joel Granados  2023-06-27  266  #endif /* IEEE 1284 support */

03ff367f259166 Joel Granados 2023-06-27 @267 struct ctl_table device_dir[1];
^1da177e4c3f41 Linus Torvalds 2005-04-16 268 };
^1da177e4c3f41 Linus Torvalds 2005-04-16 269

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw

Hey Julia

This is not a dynamic struct with a dynamic array at the end. Its a struct that has a one element struct at the end.

I think this is a false positive.

Best

Quoted 57 lines · Julia Lawall

Should device_dir be a flexible array?

julia

---------- Forwarded message ----------
Date: Wed, 19 Jul 2023 21:40:22 +0800
From: kernel test robot <[email protected]>
To: [email protected]
Cc: [email protected], Julia Lawall <[email protected]>
Subject: [joelgranados:jag/sysctl_remove_empty_elem 38/65]
drivers/parport/procfs.c:267:18-28: WARNING use flexible-array member instead
(https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-
and-one-element-arrays)

BCC: [email protected]
CC: [email protected]
TO: Joel Granados <[email protected]>

tree:   https://protect2.fireeye.com/v1/url?k=55f47919-347f6c5e-55f5f256-000babff99aa-f23173b6769c6208&q=1&e=2213ada2-9556-4e2b-85fe-ce2d0651a543&u=https%3A%2F%2Fgithub.com%2FJoelgranados%2Flinux.git jag/sysctl_remove_empty_elem
head:   a304fafc8514647e95ddf6cae2bdf2f7cd185ac1
commit: 03ff367f259166790e8982a17498c296193db2e5 [38/65] parport: rm sentinel element from ctl_table array

:::::: branch date: 22 hours ago
:::::: commit date: 23 hours ago
config: microblaze-randconfig-r062-20230717 (https://download.01.org/0day-ci/archive/20230719/[email protected]/config)
compiler: microblaze-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230719/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags

| Reported-by: kernel test robot <[email protected]>
| Reported-by: Julia Lawall <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

cocci warnings: (new ones prefixed by >>)

Quoted 1 line
Quoted 1 line

drivers/parport/procfs.c:267:18-28: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)

drivers/parport/procfs.c:364:18-28: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)

vim +267 drivers/parport/procfs.c

^1da177e4c3f41 Linus Torvalds 2005-04-16  257
^1da177e4c3f41 Linus Torvalds 2005-04-16  258
^1da177e4c3f41 Linus Torvalds 2005-04-16  259  struct parport_sysctl_table {
37e9981e33e4d3 Joel Granados  2023-06-16  260  	struct ctl_table_header *port_header;
37e9981e33e4d3 Joel Granados  2023-06-16  261  	struct ctl_table_header *devices_header;
03ff367f259166 Joel Granados  2023-06-27  262  #ifdef CONFIG_PARPORT_1284
03ff367f259166 Joel Granados  2023-06-27  263  	struct ctl_table vars[10];
03ff367f259166 Joel Granados  2023-06-27  264  #else
03ff367f259166 Joel Granados  2023-06-27  265  	struct ctl_table vars[5];
03ff367f259166 Joel Granados  2023-06-27  266  #endif /* IEEE 1284 support */

03ff367f259166 Joel Granados 2023-06-27 @267 struct ctl_table device_dir[1];
^1da177e4c3f41 Linus Torvalds 2005-04-16 268 };
^1da177e4c3f41 Linus Torvalds 2005-04-16 269

Signature · 2 lines
0-DAY CI Kernel Test Service
https://protect2.fireeye.com/v1/url?k=9cf47a02-fd7f6f45-9cf5f14d-000babff99aa-8019d91ffd5aea77&q=1&e=2213ada2-9556-4e2b-85fe-ce2d0651a543&u=https%3A%2F%2Fgithub.com%2Fintel%2Flkp-tests%2Fwiki
Signature · 1 line
Joel Granados