net: introduce helper macro for_each_cmsghdr
[cascardo/linux.git] / net / iucv / af_iucv.c
index 1cd3f81..2e9953b 100644 (file)
@@ -1070,9 +1070,7 @@ static int iucv_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
        txmsg.class = 0;
 
        /* iterate over control messages */
-       for (cmsg = CMSG_FIRSTHDR(msg); cmsg;
-               cmsg = CMSG_NXTHDR(msg, cmsg)) {
-
+       for_each_cmsghdr(cmsg, msg) {
                if (!CMSG_OK(msg, cmsg)) {
                        err = -EINVAL;
                        goto out;