lkml.org 
[lkml]   [2015]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] staging: media: lirc: lirc_zilog: Fix for possible null pointer dereference
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




\
 
 \ /
  Last update: 2015-01-30 14:21    [W:0.075 / U:2.892 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site