Skip to contentSkip to conversation

Dead code or otherwise invalid memory access in drivers/media/v4l2-core/videobuf-core.c

DISCUSSION Shaobo 1 participant 1 message Feb 17, 2017 Media (V4L/DVB)

lore
Share & tools
lore

Shaobo

author
#0 lore raw

Hey guys,

I found that the definition and usage of macro CALLPTR may be problematic. Its definition is,

Quoted 3 lines

54 #define CALLPTR(q, f, arg...)
\
55 ((q->int_ops->f) ? q->int_ops->f(arg) : NULL)

, which means it can evaluate to NULL. It has two occurrences: one in line 839 and the other is line 856. It appears to me that it's very likely that there will be invalid memory accesses if CALLPTR evaluates to NULL since there is no NULL test in either location. In other words, programmers' assumption suggest the else branch of the conditional expression dead. Please let me know if makes sense or not.

Thanks for your time and I am looking forward to your reply.

Best,
Shaobo