When test E2BIG using memfd_count, we should consider that all fds
will take one item. So the number of left item, which will trigger
E2BIG is (KDBUG_MSG_MAX_ITEMs - 1).
Signed-off-by: Sheng Yong <shyodx@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
memfds, 100);
ASSERT_RETURN(ret == -EMFILE);
- /* Combine multiple 253 fds and 128 + 1 memfds */
+ /*
+ * Combine multiple 253 fds and (128 - 1) + 1 memfds,
+ * all fds take one item, while each memfd takes one item
+ */
ret = send_fds_memfds(conn_src, conn_dst->id,
fds, KDBUS_MSG_MAX_FDS,
- memfds, KDBUS_MSG_MAX_ITEMS + 1);
+ memfds, (KDBUS_MSG_MAX_ITEMS - 1) + 1);
ASSERT_RETURN(ret == -E2BIG);
ret = send_fds_memfds(conn_src, conn_dst->id,