On Mon, Jul 17, 2017 at 11:07:44PM +0800, JingPiao Chen wrote:
> Extended ACK reporting introduced by linux kernel commit
> v4.11-rc5-1382-g2d4bc93.
> 
> * netlink.h (NLM_F_CAPPED): New macro.
> * netlink.c (decode_payload): Pass nlmsghdr to decode_nlmsgerr.
> (decode_nlmsgerr): Adjust the length pass to
> decode_nlmsghdr_with_payload.
> ---
>  netlink.c | 14 +++++++++++---
>  netlink.h |  4 ++++
>  2 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/netlink.c b/netlink.c
> index 9d480d3..6184008 100644
> --- a/netlink.c
> +++ b/netlink.c
> @@ -297,6 +297,7 @@ static void
>  decode_nlmsgerr(struct tcb *const tcp,
>               const int fd,
>               const int family,
> +             const struct nlmsghdr *const nlmsghdr,
>               kernel_ulong_t addr,
>               kernel_ulong_t len)
>  {
> @@ -321,10 +322,17 @@ decode_nlmsgerr(struct tcb *const tcp,
>       len -= offsetof(struct nlmsgerr, msg);
>  
>       if (len) {
> +             unsigned int payload =
> +                     len > nlmsghdr->nlmsg_len ? nlmsghdr->nlmsg_len : len;

As len == nlmsghdr->nlmsg_len - NLMSG_HDRLEN (unless nlmsghdr->nlmsg_len
exceeds "len" argument passed to decode_nlmsghdr_with_payload),
I don't see why this check is needed.

> +
> +             if (nlmsghdr->nlmsg_flags & NLM_F_CAPPED &&

Alternatively, you can pass (nlmsghdr->nlmsg_flags & NLM_F_CAPPED) as an
argument to decode_nlmsgerr instead of the whole nlmsghdr.


-- 
ldv

Attachment: signature.asc
Description: PGP signature

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to