linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Olivier Sobrie <olivier@sobrie.be>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: linux-can@vger.kernel.org
Subject: Re: [can:for-davem 2/3] drivers/net/can/usb/kvaser_usb.c:431 kvaser_usb_send_simple_msg() error: doing dma on the stack ((null))
Date: Thu, 22 Nov 2012 15:46:48 +0100	[thread overview]
Message-ID: <20121122144648.GA11612@hposo> (raw)
In-Reply-To: <50AE231A.2040306@pengutronix.de>

Hi Marc,

Argh.

On Thu, Nov 22, 2012 at 02:05:30PM +0100, Marc Kleine-Budde wrote:
> Hello Olivier,
> 
> can you please ask on the usb mailinglist how to fix this problem (given
> this isn't a false positive)

Ok I'll ask. By googling I found this which looks to be a similar problem
fixed in another driver.
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=32ec4576c3fb37316b1d11a04b220527822f3f0d

I assume I've to kmalloc the kvaser_msg I send through
kvaser_usb_send_msg(). I'll ask to people of linux-usb to be sure.

By the way I installed smatch (which I never used) and ran the command
 make CHECK="~/bin/smatch -p=kernel" C=1"
in my kernel dir but I didn't get the error:
  CHECK   drivers/net/can/usb/kvaser_usb.c
  CC [M]  drivers/net/can/usb/kvaser_usb.o

Do I've to give a specific option to smatch to get this error?

Thanks,

Olivier

> 
> Marc
> 
> On 11/22/2012 01:22 PM, kbuild test robot wrote:
> > tree:   git://gitorious.org/linux-can/linux-can-next for-davem
> > head:   21c837dccb1b249864b9c8475f51dad355b42554
> > commit: f0fbcc3bab6ff298bbb8c91de2ddf2824996181f [2/3] can: kvaser_usb: Add support for Kvaser CAN/USB devices
> > 
> > 
> > smatch warnings:
> > 
> > + drivers/net/can/usb/kvaser_usb.c:431 kvaser_usb_send_simple_msg() error: doing dma on the stack ((null))
> > + drivers/net/can/usb/kvaser_usb.c:1073 kvaser_usb_set_opt_mode() error: doing dma on the stack ((null))
> > + drivers/net/can/usb/kvaser_usb.c:1174 kvaser_usb_flush_queue() error: doing dma on the stack ((null))
> > + drivers/net/can/usb/kvaser_usb.c:1384 kvaser_usb_set_bittiming() error: doing dma on the stack ((null))
> > 
> > vim +431 drivers/net/can/usb/kvaser_usb.c
> > 
> > f0fbcc3b Olivier Sobrie 2012-11-21  415  end:
> > f0fbcc3b Olivier Sobrie 2012-11-21  416  	kfree(buf);
> > f0fbcc3b Olivier Sobrie 2012-11-21  417  
> > f0fbcc3b Olivier Sobrie 2012-11-21  418  	return err;
> > f0fbcc3b Olivier Sobrie 2012-11-21  419  }
> > f0fbcc3b Olivier Sobrie 2012-11-21  420  
> > f0fbcc3b Olivier Sobrie 2012-11-21  421  static int kvaser_usb_send_simple_msg(const struct kvaser_usb *dev,
> > f0fbcc3b Olivier Sobrie 2012-11-21  422  				      u8 msg_id, int channel)
> > f0fbcc3b Olivier Sobrie 2012-11-21  423  {
> > f0fbcc3b Olivier Sobrie 2012-11-21  424  	struct kvaser_msg msg = {
> > f0fbcc3b Olivier Sobrie 2012-11-21  425  		.len = MSG_HEADER_LEN + sizeof(struct kvaser_msg_simple),
> > f0fbcc3b Olivier Sobrie 2012-11-21  426  		.id = msg_id,
> > f0fbcc3b Olivier Sobrie 2012-11-21  427  		.u.simple.channel = channel,
> > f0fbcc3b Olivier Sobrie 2012-11-21  428  		.u.simple.tid = 0xff,
> > f0fbcc3b Olivier Sobrie 2012-11-21  429  	};
> > f0fbcc3b Olivier Sobrie 2012-11-21  430  
> > f0fbcc3b Olivier Sobrie 2012-11-21 @431  	return kvaser_usb_send_msg(dev, &msg);
> > f0fbcc3b Olivier Sobrie 2012-11-21  432  }
> > f0fbcc3b Olivier Sobrie 2012-11-21  433  
> > f0fbcc3b Olivier Sobrie 2012-11-21  434  static int kvaser_usb_get_software_info(struct kvaser_usb *dev)
> > f0fbcc3b Olivier Sobrie 2012-11-21  435  {
> > f0fbcc3b Olivier Sobrie 2012-11-21  436  	struct kvaser_msg msg;
> > f0fbcc3b Olivier Sobrie 2012-11-21  437  	int err;
> > f0fbcc3b Olivier Sobrie 2012-11-21  438  
> > f0fbcc3b Olivier Sobrie 2012-11-21  439  	err = kvaser_usb_send_simple_msg(dev, CMD_GET_SOFTWARE_INFO, 0);
> > 
> > ---
> > 0-DAY kernel build testing backend         Open Source Technology Center
> > Fengguang Wu, Yuanhan Liu                              Intel Corporation
> > 
> 
> 
> -- 
> Pengutronix e.K.                  | Marc Kleine-Budde           |
> Industrial Linux Solutions        | Phone: +49-231-2826-924     |
> Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
> Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |
> 



-- 
Olivier

  reply	other threads:[~2012-11-22 18:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-22 12:22 [can:for-davem 2/3] drivers/net/can/usb/kvaser_usb.c:431 kvaser_usb_send_simple_msg() error: doing dma on the stack ((null)) kbuild test robot
2012-11-22 13:05 ` Marc Kleine-Budde
2012-11-22 14:46   ` Olivier Sobrie [this message]
2012-11-22 15:50     ` Marc Kleine-Budde
2012-11-22 16:29       ` Fengguang Wu

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=20121122144648.GA11612@hposo \
    --to=olivier@sobrie.be \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    /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).