All of lore.kernel.org
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: Dan Carpenter <error27@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>,
	Adams.xu@azwave.com.cn, linux-media@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch -next 1/2] media/az6027: doing dma on the stack
Date: Tue, 04 May 2010 16:29:58 +0200	[thread overview]
Message-ID: <4BE02F66.8060300@bfs.de> (raw)
In-Reply-To: <20100504121429.GW29093@bicker>



Dan Carpenter schrieb:
> I changed the dma buffers to use allocated memory instead of stack
> memory.
> 
> The reason for this is documented in Documentation/DMA-API-HOWTO.txt
> under the section:  "What memory is DMA'able?"  That document was only
> added a couple weeks ago and there are still lots of modules which
> haven't been corrected yet.  Btw. Smatch includes a pretty good test to
> find places which use stack memory as a dma buffer.  That's how I found
> these.  (http://smatch.sf.net).
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/media/dvb/dvb-usb/az6027.c b/drivers/media/dvb/dvb-usb/az6027.c
> index 8934788..baaa301 100644
> --- a/drivers/media/dvb/dvb-usb/az6027.c
> +++ b/drivers/media/dvb/dvb-usb/az6027.c
> @@ -417,11 +417,15 @@ static int az6027_ci_read_attribute_mem(struct dvb_ca_en50221 *ca,
>  	u16 value;
>  	u16 index;
>  	int blen;
> -	u8 b[12];
> +	u8 *b;
>  
>  	if (slot != 0)
>  		return -EINVAL;
>  
> +	b = kmalloc(12, GFP_KERNEL);
> +	if (!b)
> +		return -ENOMEM;
> +
>  	mutex_lock(&state->ca_mutex);
>  
>  	req = 0xC1;


Hi Dan,
i am not sure if that is the way to go.
iff i understand the code correctly the b[12] seems to overcommit  only
blen bytes (not 12) is needed. There must be a cheaper way to send a few bytes
of space to send a command to a device. Perhaps gregKH has a hint ?

re,
 wh

  reply	other threads:[~2010-05-04 14:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-04 12:14 [patch -next 1/2] media/az6027: doing dma on the stack Dan Carpenter
2010-05-04 14:29 ` walter harms [this message]
2010-05-07  2:30   ` Mauro Carvalho Chehab

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=4BE02F66.8060300@bfs.de \
    --to=wharms@bfs.de \
    --cc=Adams.xu@azwave.com.cn \
    --cc=error27@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.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.