Re: potential-null-pointer-dereference-in-amiga-serial-driver.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 31, 2005 at 09:22:15AM -0300, Marcelo Tosatti wrote:
> 
> Hi Alexey,
> 
> On Tue, May 31, 2005 at 07:49:15PM +0400, Alexey Dobriyan wrote:
> > On Tuesday 31 May 2005 13:08, [email protected] wrote:
> > > A pointer is dereferenced before it is null-checked.
> > 
> > > --- 25/drivers/char/amiserial.c~potential-null-pointer-dereference-in-amiga-serial-driver
> > > +++ 25-akpm/drivers/char/amiserial.c
> > 
> > >  static void rs_put_char(struct tty_struct *tty, unsigned char ch)
> > >  {
> > > -	struct async_struct *info = (struct async_struct *)tty->driver_data;
> > > +	struct async_struct *info;
> > >  	unsigned long flags;
> > >  
> > > +	if (!tty)
> > > +		return;
> > 
> > Can ->put_char be ever called with tty being NULL? From my reading of
> > drivers/char/n_tty.c it can't.
> 
> Nope it can't, but the change makes the code more readable IMO, while handling
> a NULL "tty" argument properly (which the old version pretends to, but doesnt).

But unneeded checks like this are not encouraged in the kernel.  As the
tty pointer can never be null, don't worry about it.

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux