Re: [PATCH 04/20] media: uvc: uvc_v4l2.c: add temp variable for list iteration

From: Daniel W. S. Almeida
Date: Mon Aug 10 2020 - 09:10:53 EST


Hi Laurent, thanks for reviewing!

> If no entity is found by this loop the next line will dereference a NULL
> pointer. There's a similar issue below.

You mean this line, right?
> pin = iterm->id;

In which case, yes I missed it!

> I think the issues reported by coccinelle are false positives, as every
> chain is guaranteed to have the proper input terminals (ITERM). This is
> verified when constructing the chain at probe time.

I thought so too, but I thought it would be nice to get rid of the
warning anyways. Probably other people will send patches for this same
issue in the future too, i.e. until this warning is not there anymore.

Do you have any suggestions or should we just leave this alone? :)

Maybe:

if (iterm)
pin = iterm->id


This line will return an error if the iterm is not found anyway:

if (iterm == NULL || iterm->id != pin)
return -EINVAL


Let me know what you think

- Daniel