linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mattias Jacobsson <2pi@mok.nu>
To: <yamada.masahiro@socionext.com>, <michal.lkml@markovi.net>
Cc: <2pi@mok.nu>, <linux-kbuild@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH] modpost: file2alias: define size of alias
Date: Thu, 7 Feb 2019 13:30:22 +0100	[thread overview]
Message-ID: <20190207123022.7961-1-2pi@mok.nu> (raw)

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 <2pi@mok.nu>
---

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

[1]: https://lore.kernel.org/lkml/20190128150909.4r3tje5l34u5t2xs@mok.nu/
[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


             reply	other threads:[~2019-02-07 12:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-07 12:30 Mattias Jacobsson [this message]
2019-02-18  7:20 ` [PATCH] modpost: file2alias: define size of alias Masahiro Yamada
2019-02-19 20:08   ` Mattias Jacobsson
2019-02-19 23:47     ` Masahiro Yamada
2019-02-23 19:57       ` Mattias Jacobsson
2019-03-07  6:09         ` Darren Hart
2019-03-07  6:17           ` Darren Hart
2019-03-07  6:20             ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190207123022.7961-1-2pi@mok.nu \
    --to=2pi@mok.nu \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).