All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Valdis.Kletnieks@vt.edu
Cc: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>,
	devel@driverdev.osuosl.org, Gulsah Kose <gulsah.1004@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jarod Wilson <jarod@wilsonet.com>,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	linux-kernel@vger.kernel.org,
	Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>,
	Martin Kaiser <martin@kaiser.cx>,
	linux-media@vger.kernel.org,
	Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Subject: Re: [PATCH] staging: media: lirc: lirc_zilog: Fix for possible null pointer dereference
Date: Fri, 30 Jan 2015 16:00:02 +0300	[thread overview]
Message-ID: <20150130130001.GZ6456@mwanda> (raw)
In-Reply-To: <21497.1422569560@turing-police.cc.vt.edu>

On Thu, Jan 29, 2015 at 05:12:40PM -0500, Valdis.Kletnieks@vt.edu wrote:
> On Thu, 29 Jan 2015 19:48:08 +0100, Rickard Strandqvist said:
> > Fix a possible null pointer dereference, there is
> > otherwise a risk of a possible null pointer dereference.
> >
> > This was found using a static code analysis program called cppcheck
> >
> > Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> > ---
> >  drivers/staging/media/lirc/lirc_zilog.c |    4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> >  	/* find our IR struct */
> >  	struct IR *ir = filep->private_data;
> >
> > -	if (ir == NULL) {
> > -		dev_err(ir->l.dev, "close: no private_data attached to the file!\n");
> 
> Yes, the dev_err() call is an obvious thinko.
> 
> However, I'm not sure whether removing it entirely is right either.  If
> there *should* be a struct IR * passed there, maybe some other printk()
> should be issued, or even a WARN_ON(!ir), or something?

We set filep->private_data to non-NULL in open() so I don't think it can
be NULL here.

regards,
dan carpenter



  reply	other threads:[~2015-01-30 13:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-29 18:48 [PATCH] staging: media: lirc: lirc_zilog: Fix for possible null pointer dereference Rickard Strandqvist
2015-01-29 22:12 ` Valdis.Kletnieks
2015-01-30 13:00   ` Dan Carpenter [this message]
2015-01-30 13:09     ` Valdis.Kletnieks
2015-01-30 17:06       ` Rickard Strandqvist
2015-01-31  0:01       ` Andy Walls

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=20150130130001.GZ6456@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=gulsah.1004@gmail.com \
    --cc=jarod@wilsonet.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mahfouz.saif.elyazal@gmail.com \
    --cc=martin@kaiser.cx \
    --cc=mchehab@osg.samsung.com \
    --cc=rickard_strandqvist@spectrumdigital.se \
    --cc=tuomas.tynkkynen@iki.fi \
    /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.