Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] lirc_dev: avoid potential null-dereference

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>

authored by

Andy Shevchenko and committed by
Mauro Carvalho Chehab
3656cddd 5ee803a2

+3 -3
+3 -3
drivers/media/rc/lirc_dev.c
··· 553 553 if (!ir->attached) 554 554 return POLLERR; 555 555 556 - poll_wait(file, &ir->buf->wait_poll, wait); 556 + if (ir->buf) { 557 + poll_wait(file, &ir->buf->wait_poll, wait); 557 558 558 - if (ir->buf) 559 559 if (lirc_buffer_empty(ir->buf)) 560 560 ret = 0; 561 561 else 562 562 ret = POLLIN | POLLRDNORM; 563 - else 563 + } else 564 564 ret = POLLERR; 565 565 566 566 dev_dbg(ir->d.dev, LOGHEAD "poll result = %d\n",