freebsd-dev/sys/ofed/drivers/infiniband
Hans Petter Selasky 05f4691919 ibcore: Clean up INIT_UDATA() and INIT_UDATA_BUF_OR_NULL() macro usage.
We get a harmless warning about the fact that we use the result of a
multiplication as a condition in INIT_UDATA_BUF_OR_NULL():

uverbs_main.c: In function 'ib_uverbs_write':
error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context]

This avoids the problem by using an inline function in place of
the macro.

After changing INIT_UDATA_BUF_OR_NULL() to an inline function,
do the same change to INIT_UDATA() for consistency.

Using an inline function gives us better type safety here among other
issues with macros. I'm using u64_to_user_ptr() to convert the user
pointer to simplify the logic rather than adding lots of new type casts.

Linux commit:
12f727721eee61b3d19dedb95cb893b2baa9fe41
40a203396cc1c239f2e71c47c66ed03097123d2c

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:32 +02:00
..
core ibcore: Clean up INIT_UDATA() and INIT_UDATA_BUF_OR_NULL() macro usage. 2021-07-12 14:22:32 +02:00
ulp ipoib: Destroying a CQ should never fail. 2021-07-12 14:22:29 +02:00
util Infiniband clients must be attached and detached in a specific order in ibcore. 2020-07-06 08:50:11 +00:00