Skip to contentSkip to conversation

modpost: file2alias: define size of alias

PATCH In review Mattias Jacobsson 3 participants 8 messages Feb 7, 2019 – Mar 7, 2019 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 modpost: file2alias: define size of alias

The size of the variable alias provided to do_entry functions are currently not readily available. Thus hindering do_entry functions to perform bounds checking.

Define the macro ALIAS_SIZE containing the size of the variable alias.

---

Related discussion: [1] and [2] (around the first answer line)

[1]: https://lore.kernel.org/lkml/[email protected]/
[2]: https://lore.kernel.org/lkml/CAHp75VcLizx+jtMrbc3Ev-HcJVEjH2naFC0sj=7fX5nZSCGc8Q@mail.gmail.com/

---

 scripts/mod/file2alias.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
scripts/mod/file2alias.c +4 -1
index a37af7d71973..afe22af20d7d 100644
@@ -50,6 +50,9 @@ struct devtable {
 	int (*do_entry)(const char *filename, void *symval, char *alias);
 };
 
+/* Size of alias provided to do_entry functions */
+#define ALIAS_SIZE 500
+
 /* Define a variable f that holds the value of field f of struct devid
  * based at address m.
  */
@@ -1303,7 +1306,7 @@ static void do_table(void *symval, unsigned long size,
 		     struct module *mod)
 {
 	unsigned int i;
-	char alias[500];
+	char alias[ALIAS_SIZE];
 
 	device_id_check(mod->name, device_id, size, id_size, symval);
 	/* Leave last one: it's the terminator. */
Signature · 1 line
2.20.1
#1 lore raw

Hi Mattias,

Quoted 8 lines · Mattias Jacobsson

The size of the variable alias provided to do_entry functions are currently not readily available. Thus hindering do_entry functions to perform bounds checking.

Define the macro ALIAS_SIZE containing the size of the variable alias.

Sorry for late reply.

I can apply this to my kbuild tree shortly, but
it looks like a prerequisite for your
"platform/x86: wmi: use MODULE_DEVICE_TABLE() instead of MODULE_ALIAS()"

If you want all the patches to go through x86 platform-driver tree, I am fine with that too.

Please let me know what you want.

Thanks.

Signature · 2 lines
Best Regards
Masahiro Yamada
#2 lore raw

Hi Masahiro,

Quoted 15 lines · Masahiro Yamada

Hi Mattias,

Quoted 8 lines · Mattias Jacobsson

The size of the variable alias provided to do_entry functions are currently not readily available. Thus hindering do_entry functions to perform bounds checking.

Define the macro ALIAS_SIZE containing the size of the variable alias.

Sorry for late reply.

Quoted 7 lines

I can apply this to my kbuild tree shortly, but
it looks like a prerequisite for your
"platform/x86: wmi: use MODULE_DEVICE_TABLE() instead of MODULE_ALIAS()"

If you want all the patches to go through x86 platform-driver tree, I am fine with that too.

I don't mind either way, however I've asked the x86 platform-driver maintainers if they have a preference in this matter. You should have received that mail otherwise see [1].

[1]: https://lkml.kernel.org/r/082d3d38b7dde6050b6b3e518ada439eade65b2c.1550603967.git.2pi@mok.nu

Quoted 10 lines

Please let me know what you want.

Thanks.

Signature · 2 lines
Best Regards
Masahiro Yamada

Thanks,
Mattias

#3 lore raw
Quoted 24 lines · Mattias Jacobsson

Hi Masahiro,

Quoted 20 lines · Masahiro Yamada

Hi Mattias,

Quoted 8 lines · Mattias Jacobsson

The size of the variable alias provided to do_entry functions are currently not readily available. Thus hindering do_entry functions to perform bounds checking.

Define the macro ALIAS_SIZE containing the size of the variable alias.

Sorry for late reply.

I can apply this to my kbuild tree shortly, but
it looks like a prerequisite for your
"platform/x86: wmi: use MODULE_DEVICE_TABLE() instead of MODULE_ALIAS()"

Quoted 8 lines
Quoted 2 lines

If you want all the patches to go through x86 platform-driver tree, I am fine with that too.

I don't mind either way, however I've asked the x86 platform-driver maintainers if they have a preference in this matter. You should have received that mail otherwise see [1].

[1]: https://lkml.kernel.org/r/082d3d38b7dde6050b6b3e518ada439eade65b2c.1550603967.git.2pi@mok.nu

I saw it. The 2/8 uses ALIAS_SIZE.

So, I think it will be better to include this one in your series. If necessary, please feel free to add

Quoted 13 lines
Quoted 10 lines

Please let me know what you want.

Thanks.

--
Best Regards
Masahiro Yamada

Thanks,
Mattias

Signature · 2 lines
Best Regards
Masahiro Yamada
#4 lore raw
Quoted 35 lines · Masahiro Yamada
Quoted 24 lines · Mattias Jacobsson

Hi Masahiro,

Quoted 20 lines · Masahiro Yamada

Hi Mattias,

Quoted 8 lines · Mattias Jacobsson

The size of the variable alias provided to do_entry functions are currently not readily available. Thus hindering do_entry functions to perform bounds checking.

Define the macro ALIAS_SIZE containing the size of the variable alias.

Sorry for late reply.

I can apply this to my kbuild tree shortly, but
it looks like a prerequisite for your
"platform/x86: wmi: use MODULE_DEVICE_TABLE() instead of MODULE_ALIAS()"

Quoted 8 lines
Quoted 2 lines

If you want all the patches to go through x86 platform-driver tree, I am fine with that too.

I don't mind either way, however I've asked the x86 platform-driver maintainers if they have a preference in this matter. You should have received that mail otherwise see [1].

[1]: https://lkml.kernel.org/r/082d3d38b7dde6050b6b3e518ada439eade65b2c.1550603967.git.2pi@mok.nu

Quoted 7 lines

I saw it. The 2/8 uses ALIAS_SIZE.

So, I think it will be better to include this one in your series. If necessary, please feel free to add

Okey, will do. Thanks!

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Please let me know what you want.

Thanks.

Quoted 12 lines
Quoted 6 lines
Quoted 3 lines

--
Best Regards
Masahiro Yamada

Thanks,
Mattias

Signature · 2 lines
Best Regards
Masahiro Yamada

Thanks,
Mattias

#5 lore raw
Quoted 14 lines · Mattias Jacobsson
Quoted 12 lines · Masahiro Yamada
Quoted 8 lines
Quoted 2 lines

If you want all the patches to go through x86 platform-driver tree, I am fine with that too.

I don't mind either way, however I've asked the x86 platform-driver maintainers if they have a preference in this matter. You should have received that mail otherwise see [1].

[1]: https://lkml.kernel.org/r/082d3d38b7dde6050b6b3e518ada439eade65b2c.1550603967.git.2pi@mok.nu

I saw it. The 2/8 uses ALIAS_SIZE.

Quoted 7 lines
Quoted 5 lines

So, I think it will be better to include this one in your series. If necessary, please feel free to add

Okey, will do. Thanks!

Agree, I'll pull it in.

Signature · 2 lines
Darren Hart
VMware Open Source Technology Center
#6 lore raw
Quoted 18 lines · Darren Hart
Quoted 17 lines · Mattias Jacobsson
Quoted 15 lines · Masahiro Yamada
Quoted 8 lines
Quoted 2 lines

If you want all the patches to go through x86 platform-driver tree, I am fine with that too.

I don't mind either way, however I've asked the x86 platform-driver maintainers if they have a preference in this matter. You should have received that mail otherwise see [1].

[1]: https://lkml.kernel.org/r/082d3d38b7dde6050b6b3e518ada439eade65b2c.1550603967.git.2pi@mok.nu

I saw it. The 2/8 uses ALIAS_SIZE.

So, I think it will be better to include this one in your series. If necessary, please feel free to add

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Okey, will do. Thanks!

Agree, I'll pull it in.

Masahiro, may I include your Acked-by on the 2/8 patch as well?

platform/x86: wmi: add WMI support to MODULE_DEVICE_TABLE()

Signature · 2 lines
Darren Hart
VMware Open Source Technology Center
#7 lore raw

Hi Darren,

Quoted 23 lines · Darren Hart
Quoted 21 lines · Darren Hart
Quoted 20 lines · Mattias Jacobsson
Quoted 17 lines · Masahiro Yamada
Quoted 8 lines
Quoted 2 lines

If you want all the patches to go through x86 platform-driver tree, I am fine with that too.

I don't mind either way, however I've asked the x86 platform-driver maintainers if they have a preference in this matter. You should have received that mail otherwise see [1].

[1]: https://lkml.kernel.org/r/082d3d38b7dde6050b6b3e518ada439eade65b2c.1550603967.git.2pi@mok.nu

I saw it. The 2/8 uses ALIAS_SIZE.

So, I think it will be better to include this one in your series. If necessary, please feel free to add

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Okey, will do. Thanks!

Agree, I'll pull it in.

Masahiro, may I include your Acked-by on the 2/8 patch as well?

Sure. Please go ahead.

Quoted 5 lines

platform/x86: wmi: add WMI support to MODULE_DEVICE_TABLE()

--
Darren Hart
VMware Open Source Technology Center

Signature · 2 lines
Best Regards
Masahiro Yamada