net: introduce helper macro for_each_cmsghdr
Introduce helper macro for_each_cmsghdr as a wrapper of the enumerating cmsghdr from msghdr, just cleanup. Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
dd0bcc0bc8
commit
f95b414edb
@ -6592,8 +6592,7 @@ static int sctp_msghdr_parse(const struct msghdr *msg, sctp_cmsgs_t *cmsgs)
|
||||
struct cmsghdr *cmsg;
|
||||
struct msghdr *my_msg = (struct msghdr *)msg;
|
||||
|
||||
for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL;
|
||||
cmsg = CMSG_NXTHDR(my_msg, cmsg)) {
|
||||
for_each_cmsghdr(cmsg, my_msg) {
|
||||
if (!CMSG_OK(my_msg, cmsg))
|
||||
return -EINVAL;
|
||||
|
||||
|
Reference in New Issue
Block a user