2019-02-07 12:31:45

by Mattias Jacobsson

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Mattias Jacobsson <[email protected]>
---

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(-)

diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index a37af7d71973..afe22af20d7d 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -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. */
--
2.20.1



2019-02-18 07:22:54

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH] modpost: file2alias: define size of alias

Hi Mattias,

On Thu, Feb 7, 2019 at 9:31 PM Mattias Jacobsson <[email protected]> wrote:
>
> 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.
>
> Signed-off-by: Mattias Jacobsson <[email protected]>


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.



--
Best Regards
Masahiro Yamada

2019-02-19 20:10:04

by Mattias Jacobsson

[permalink] [raw]
Subject: Re: [PATCH] modpost: file2alias: define size of alias

Hi Masahiro,

On 2019-02-18, Masahiro Yamada wrote:
> Hi Mattias,
>
> On Thu, Feb 7, 2019 at 9:31 PM Mattias Jacobsson <[email protected]> wrote:
> >
> > 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.
> >
> > Signed-off-by: Mattias Jacobsson <[email protected]>
>
>
> 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.

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

>
> Please let me know what you want.
>
> Thanks.
>
>
>
> --
> Best Regards
> Masahiro Yamada

Thanks,
Mattias

2019-02-19 23:48:28

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH] modpost: file2alias: define size of alias

On Wed, Feb 20, 2019 at 5:09 AM Mattias Jacobsson <[email protected]> wrote:
>
> Hi Masahiro,
>
> On 2019-02-18, Masahiro Yamada wrote:
> > Hi Mattias,
> >
> > On Thu, Feb 7, 2019 at 9:31 PM Mattias Jacobsson <[email protected]> wrote:
> > >
> > > 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.
> > >
> > > Signed-off-by: Mattias Jacobsson <[email protected]>
> >
> >
> > 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.
>
> 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

Acked-by: Masahiro Yamada <[email protected]>


> >
> > Please let me know what you want.
> >
> > Thanks.
> >
> >
> >
> > --
> > Best Regards
> > Masahiro Yamada
>
> Thanks,
> Mattias



--
Best Regards
Masahiro Yamada

2019-02-23 19:58:48

by Mattias Jacobsson

[permalink] [raw]
Subject: Re: [PATCH] modpost: file2alias: define size of alias

On 2019-02-20, Masahiro Yamada wrote:
> On Wed, Feb 20, 2019 at 5:09 AM Mattias Jacobsson <[email protected]> wrote:
> >
> > Hi Masahiro,
> >
> > On 2019-02-18, Masahiro Yamada wrote:
> > > Hi Mattias,
> > >
> > > On Thu, Feb 7, 2019 at 9:31 PM Mattias Jacobsson <[email protected]> wrote:
> > > >
> > > > 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.
> > > >
> > > > Signed-off-by: Mattias Jacobsson <[email protected]>
> > >
> > >
> > > 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.
> >
> > 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
>
> Acked-by: Masahiro Yamada <[email protected]>
>

Okey, will do. Thanks!

>
> > >
> > > Please let me know what you want.
> > >
> > > Thanks.
> > >
> > >
> > >
> > > --
> > > Best Regards
> > > Masahiro Yamada
> >
> > Thanks,
> > Mattias
>
>
>
> --
> Best Regards
> Masahiro Yamada

Thanks,
Mattias

2019-03-07 06:10:08

by Darren Hart

[permalink] [raw]
Subject: Re: [PATCH] modpost: file2alias: define size of alias

On Sat, Feb 23, 2019 at 08:57:50PM +0100, Mattias Jacobsson wrote:
> On 2019-02-20, Masahiro Yamada wrote:

> > > > 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
> >
> > Acked-by: Masahiro Yamada <[email protected]>
> >
>
> Okey, will do. Thanks!


Agree, I'll pull it in.


--
Darren Hart
VMware Open Source Technology Center

2019-03-07 06:17:52

by Darren Hart

[permalink] [raw]
Subject: Re: [PATCH] modpost: file2alias: define size of alias

On Wed, Mar 06, 2019 at 10:09:26PM -0800, Darren Hart wrote:
> On Sat, Feb 23, 2019 at 08:57:50PM +0100, Mattias Jacobsson wrote:
> > On 2019-02-20, Masahiro Yamada wrote:
>
> > > > > 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
> > >
> > > Acked-by: Masahiro Yamada <[email protected]>
> > >
> >
> > 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()

--
Darren Hart
VMware Open Source Technology Center

2019-03-07 06:23:51

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH] modpost: file2alias: define size of alias

Hi Darren,


On Thu, Mar 7, 2019 at 3:17 PM Darren Hart <[email protected]> wrote:
>
> On Wed, Mar 06, 2019 at 10:09:26PM -0800, Darren Hart wrote:
> > On Sat, Feb 23, 2019 at 08:57:50PM +0100, Mattias Jacobsson wrote:
> > > On 2019-02-20, Masahiro Yamada wrote:
> >
> > > > > > 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
> > > >
> > > > Acked-by: Masahiro Yamada <[email protected]>
> > > >
> > >
> > > 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.




> platform/x86: wmi: add WMI support to MODULE_DEVICE_TABLE()
>
> --
> Darren Hart
> VMware Open Source Technology Center



--
Best Regards
Masahiro Yamada