Re: [PATCH 1/7] device: prevent a NULL pointer dereference in __intel_peek_fd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 15, 2016 at 12:24:04PM +0000, Dave Gordon wrote:
> On 12/02/16 16:31, Martin Peres wrote:
> >This is not a big issue to return -1 since the only codepath that uses
> >it is for display purposes.
> >
> >Caught by Klockwork.
> >
> >Signed-off-by: Martin Peres <martin.peres@xxxxxxxxxxxxxxx>
> >---
> >  src/intel_device.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> >diff --git a/src/intel_device.c b/src/intel_device.c
> >index 54c1443..35e652a 100644
> >--- a/src/intel_device.c
> >+++ b/src/intel_device.c
> >@@ -650,7 +650,10 @@ int __intel_peek_fd(ScrnInfoPtr scrn)
> >  	dev = intel_device(scrn);
> >  	assert(dev && dev->fd != -1);
> 
> Doesn't Klocwork recognise the assert() above?
> I thought that would tell it that dev can't be NULL.

My guess is that klockwork recognises that assert() can be a no-op
if NDEBUG is defined and in such case won't generate code.
In such a case neither of those two checks are performed.


Kind regards, David
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux