From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: "David Härdeman" <david@hardeman.nu>
Cc: linux-media@vger.kernel.org, sean@mess.org
Subject: Re: [PATCH 07/19] lirc_dev: remove kmalloc in lirc_dev_fop_read()
Date: Wed, 4 Oct 2017 13:56:51 -0300 [thread overview]
Message-ID: <20171004135558.53df2b1d@recife.lan> (raw)
In-Reply-To: <149839391031.28811.5094791739782133013.stgit@zeus.hardeman.nu>
Em Sun, 25 Jun 2017 14:31:50 +0200
David Härdeman <david@hardeman.nu> escreveu:
> lirc_zilog uses a chunk_size of 2 and ir-lirc-codec uses sizeof(int).
>
> Therefore, using stack memory should be perfectly fine.
>
> Signed-off-by: David Härdeman <david@hardeman.nu>
> ---
> drivers/media/rc/lirc_dev.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
> index 1773a2934484..92048d945ba7 100644
> --- a/drivers/media/rc/lirc_dev.c
> +++ b/drivers/media/rc/lirc_dev.c
> @@ -376,7 +376,7 @@ ssize_t lirc_dev_fop_read(struct file *file,
> loff_t *ppos)
> {
> struct irctl *ir = file->private_data;
> - unsigned char *buf;
> + unsigned char buf[ir->buf->chunk_size];
No. We don't do dynamic buffer allocation on stak at the Kernel,
as this could cause the Linux stack to overflow without notice.
This should also generate alerts on static code analyzers like
sparse.
I'll drop this patch from the series.
Thanks,
Mauro
next prev parent reply other threads:[~2017-10-04 16:57 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-25 12:31 [PATCH 00/19] lirc_dev modernisation David Härdeman
2017-06-25 12:31 ` [PATCH 01/19] lirc_dev: clarify error handling David Härdeman
2017-06-25 12:31 ` [PATCH 02/19] lirc_dev: remove support for manually specifying minor number David Härdeman
2017-06-25 12:31 ` [PATCH 03/19] lirc_dev: remove min_timeout and max_timeout David Härdeman
2017-06-25 12:31 ` [PATCH 04/19] lirc_dev: use cdev_device_add() helper function David Härdeman
2017-06-25 12:31 ` [PATCH 05/19] lirc_dev: make better use of file->private_data David Härdeman
2017-06-25 12:31 ` [PATCH 06/19] lirc_dev: make chunk_size and buffer_size mandatory David Härdeman
2017-06-25 12:31 ` [PATCH 07/19] lirc_dev: remove kmalloc in lirc_dev_fop_read() David Härdeman
2017-10-04 16:56 ` Mauro Carvalho Chehab [this message]
2017-10-09 9:45 ` David Härdeman
2017-06-25 12:31 ` [PATCH 08/19] lirc_dev: change irctl->attached to be a boolean David Härdeman
2017-06-25 12:32 ` [PATCH 09/19] lirc_dev: sanitize locking David Härdeman
2017-06-25 12:32 ` [PATCH 10/19] lirc_dev: use an IDA instead of an array to keep track of registered devices David Härdeman
2017-06-25 12:32 ` [PATCH 11/19] lirc_dev: rename struct lirc_driver to struct lirc_dev David Härdeman
2017-06-25 12:32 ` [PATCH 12/19] lirc_dev: introduce lirc_allocate_device and lirc_free_device David Härdeman
2017-06-25 12:32 ` [PATCH 13/19] lirc_dev: remove the BUFLEN define David Härdeman
2017-06-25 12:32 ` [PATCH 14/19] lirc_zilog: add a pointer to the parent device to struct IR David Härdeman
2017-06-25 12:32 ` [PATCH 15/19] lirc_zilog: use a dynamically allocated lirc_dev David Härdeman
2017-06-25 12:32 ` [PATCH 16/19] lirc_dev: merge struct irctl into struct lirc_dev David Härdeman
2017-06-25 12:32 ` [PATCH 17/19] ir-lirc-codec: merge lirc_dev_fop_ioctl into ir_lirc_ioctl David Härdeman
2017-06-25 12:32 ` [PATCH 18/19] ir-lirc-codec: move the remaining fops over from lirc_dev David Härdeman
2017-06-25 12:32 ` [PATCH 19/19] lirc_dev: consistent device registration printk David Härdeman
2017-08-01 21:20 ` Sean Young
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=20171004135558.53df2b1d@recife.lan \
--to=mchehab@s-opensource.com \
--cc=david@hardeman.nu \
--cc=linux-media@vger.kernel.org \
--cc=sean@mess.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.