public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>,
	akpm@osdl.org, julien.tinnes@francetelecom.com,
	linux-kernel@vger.kernel.org
Subject: Re: potential-null-pointer-dereference-in-amiga-serial-driver.patch added to -mm tree
Date: Wed, 1 Jun 2005 22:21:08 -0700	[thread overview]
Message-ID: <20050602052108.GA8042@kroah.com> (raw)
In-Reply-To: <20050531122215.GA5108@logos.cnet>

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, akpm@osdl.org 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

  reply	other threads:[~2005-06-02  5:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200505310909.j4V98xBR008727@shell0.pdx.osdl.net>
2005-05-31 15:49 ` potential-null-pointer-dereference-in-amiga-serial-driver.patch added to -mm tree Alexey Dobriyan
2005-05-31 12:22   ` Marcelo Tosatti
2005-06-02  5:21     ` Greg KH [this message]
2005-06-03  7:58       ` Marcelo Tosatti
2005-06-09  9:31         ` Julien TINNES

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=20050602052108.GA8042@kroah.com \
    --to=greg@kroah.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@osdl.org \
    --cc=julien.tinnes@francetelecom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com \
    /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