From: Andreas Schwab <schwab@linux-m68k.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
linux-input@vger.kernel.org, linux-m68k@vger.kernel.org
Subject: Re: [PATCH 2/2] Input: amikbd - Allocate temporary keymap buffer dynamically
Date: Thu, 27 Nov 2014 12:17:12 +0100 [thread overview]
Message-ID: <87wq6gvqo7.fsf@igel.home> (raw)
In-Reply-To: <1417081340-2989-2-git-send-email-geert@linux-m68k.org> (Geert Uytterhoeven's message of "Thu, 27 Nov 2014 10:42:20 +0100")
Geert Uytterhoeven <geert@linux-m68k.org> writes:
> @@ -147,13 +148,18 @@ static unsigned char amikbd_keycode[0x78] __initdata = {
>
> static void __init amikbd_init_console_keymaps(void)
> {
> + unsigned short *temp_map;
> + size_t temp_map_size = NR_KEYS * sizeof(*temp_map);
> int i, j;
>
> + temp_map = kmalloc(temp_map_size, GFP_KERNEL);
> + if (!temp_map)
> + return;
> +
> for (i = 0; i < MAX_NR_KEYMAPS; i++) {
> - static u_short temp_map[NR_KEYS] __initdata;
> if (!key_maps[i])
> continue;
> - memset(temp_map, 0, sizeof(temp_map));
> + memset(temp_map, 0, temp_map_size);
> for (j = 0; j < 0x78; j++) {
> if (!amikbd_keycode[j])
> continue;
How about allocating it on the stack? With NR_KEYS == 256 that means
512 bytes, which should be ok, doesn't it?
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
prev parent reply other threads:[~2014-11-27 11:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-27 9:42 [PATCH 1/2] Input: amikbd - Fix build if !CONFIG_HW_CONSOLE Geert Uytterhoeven
2014-11-27 9:42 ` [PATCH 2/2] Input: amikbd - Allocate temporary keymap buffer dynamically Geert Uytterhoeven
2014-11-27 11:17 ` Andreas Schwab [this message]
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=87wq6gvqo7.fsf@igel.home \
--to=schwab@linux-m68k.org \
--cc=dmitry.torokhov@gmail.com \
--cc=geert@linux-m68k.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-m68k@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.