Skip to content
Commit a96e4e2f authored by Roland Dreier's avatar Roland Dreier
Browse files

IB/uverbs: New macro to set pointers to NULL if length is 0 in INIT_UDATA()



Trying to have a ternary operator to choose between NULL (or 0) and the
real pointer value in invocations leads to an impossible choice between
a sparse error about a literal 0 used as a NULL pointer, and a gcc
warning about "pointer/integer type mismatch in conditional expression."

Rather than clutter the source with more casts, move the ternary
operator into a new INIT_UDATA_BUF_OR_NULL() macro, which makes it
easier to use and simplifies its callers.

Reported-by: default avatarYann Droneaud <ydroneaud@opteya.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent 309243ec
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment