linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [kbuild-all] [wireless-next:master 316/316] drivers/net/wireless/rsi/rsi_91x_debugfs.c:296 rsi_init_dbgfs() error: potential null dereference 'dev_dbgfs'. (kzalloc returns null)
       [not found] ` <20140327154507.GA27177@mwanda>
@ 2014-03-27 16:01   ` Dan Carpenter
       [not found]     ` <CAG+h2qigvA+yfPt9iRv6eZCLppwFznuZ=Hdk5Yxr-EB_9WTQig@mail.gmail.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2014-03-27 16:01 UTC (permalink / raw)
  To: Fariya Fatima, kbuild, linux-wireless

On Thu, Mar 27, 2014 at 06:45:07PM +0300, Dan Carpenter wrote:
> > drivers/net/wireless/rsi/rsi_91x_usb.c:289 rsi_usb_write_register_multiple() warn: '__min2' 4096 can't fit into 255 'transfer'

The code for this one is:

	transfer = min_t(int, count, 4096);

It's complaining because "tranfers" is u8, but the cast to int always
makes me worry negative values.  In this case, count is not user
controlled so it's safe.  But that's a common security problem you
should be aware of.  It's better to cast it to an unsigned value.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [kbuild-all] [wireless-next:master 316/316] drivers/net/wireless/rsi/rsi_91x_debugfs.c:296 rsi_init_dbgfs() error: potential null dereference 'dev_dbgfs'. (kzalloc returns null)
       [not found]     ` <CAG+h2qigvA+yfPt9iRv6eZCLppwFznuZ=Hdk5Yxr-EB_9WTQig@mail.gmail.com>
@ 2014-03-28  9:01       ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2014-03-28  9:01 UTC (permalink / raw)
  To: Fariya; +Cc: kbuild, linux-wireless

On Fri, Mar 28, 2014 at 07:51:25AM +0530, Fariya wrote:
> Hi Dan,
> 
> Do I need to re-send the whole of the driver again? Considering the driver
> is a part of wireless-next, shall I check-out the wireless-next git repo
> and create a patch for the mentioned fixes and send it across?

The latter.  Do it on top of wireles-next.

> 
> > *The code for this one is:         transfer = min_t(int, count, 4096); It's
> > complaining because "tranfers" is u8, but the cast to int always makes me
> > worry negative values.  In this case, count is not user controlled so it's
> > safe.  But that's a common security problem you should be aware of.  It's
> > better to cast it to an unsigned value.*
> 
> >Shall I typecast the return value of min_t to u8?

No.  That would do a truncate to 8 bits before the compare.  Cast it to
u32 first.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-28  9:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <53275729.QHDAYltTUiN7HGNZ%fengguang.wu@intel.com>
     [not found] ` <20140327154507.GA27177@mwanda>
2014-03-27 16:01   ` [kbuild-all] [wireless-next:master 316/316] drivers/net/wireless/rsi/rsi_91x_debugfs.c:296 rsi_init_dbgfs() error: potential null dereference 'dev_dbgfs'. (kzalloc returns null) Dan Carpenter
     [not found]     ` <CAG+h2qigvA+yfPt9iRv6eZCLppwFznuZ=Hdk5Yxr-EB_9WTQig@mail.gmail.com>
2014-03-28  9:01       ` Dan Carpenter

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).