Skip to content

Commit

Permalink
[media] lirc_dev: avoid potential null-dereference
Browse files Browse the repository at this point in the history
We have to check pointer for NULL and then dereference it.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
  • Loading branch information
Andy Shevchenko authored and Mauro Carvalho Chehab committed Feb 3, 2015
1 parent 5ee803a commit 3656cdd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/media/rc/lirc_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,14 +553,14 @@ unsigned int lirc_dev_fop_poll(struct file *file, poll_table *wait)
if (!ir->attached)
return POLLERR;

poll_wait(file, &ir->buf->wait_poll, wait);
if (ir->buf) {
poll_wait(file, &ir->buf->wait_poll, wait);

if (ir->buf)
if (lirc_buffer_empty(ir->buf))
ret = 0;
else
ret = POLLIN | POLLRDNORM;
else
} else
ret = POLLERR;

dev_dbg(ir->d.dev, LOGHEAD "poll result = %d\n",
Expand Down

0 comments on commit 3656cdd

Please sign in to comment.