]> granicus.if.org Git - strace/commitdiff
netlink_sock_diag: replace NLA_ALIGN with NLMSG_ALIGN
authorJingPiao Chen <chenjingpiao@gmail.com>
Wed, 19 Jul 2017 14:55:53 +0000 (22:55 +0800)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 22 Jul 2017 15:31:09 +0000 (15:31 +0000)
In several netlink_sock_diag parsers NLA_ALIGN was used instead of
NLMSG_ALIGN to align the length of netlink messages.  Fortunately,
both macros round the given length to the closest multiple of 4,
so technically there is no difference, but the use of wrong macro
is misleading.

* netlink_inet_diag.c (decode_inet_diag_req_compat,
decode_inet_diag_req_v2, decode_inet_diag_msg): Replace
NLA_ALIGN with NLMSG_ALIGN.
* netlink_netlink_diag.c (decode_netlink_diag_msg): Likewise.
* netlink_packet_diag.c (decode_packet_diag_msg): Likewise.
* netlink_smc_diag.c (decode_smc_diag_msg): Likewise.

netlink_inet_diag.c
netlink_netlink_diag.c
netlink_packet_diag.c
netlink_smc_diag.c

index eb216f588665aa79d24d6550a21b8d9796d3a074..34fffc8a3c54331222fb7a7a01e23f8fbdb6b477 100644 (file)
@@ -255,7 +255,7 @@ decode_inet_diag_req_compat(struct tcb *const tcp,
                tprints("...");
        tprints("}");
 
-       offset = NLA_ALIGN(sizeof(req));
+       offset = NLMSG_ALIGN(sizeof(req));
        if (decode_nla && len > offset) {
                tprints(", ");
                decode_nlattr(tcp, addr + offset, len - offset,
@@ -297,7 +297,7 @@ decode_inet_diag_req_v2(struct tcb *const tcp,
                tprints("...");
        tprints("}");
 
-       offset = NLA_ALIGN(sizeof(req));
+       offset = NLMSG_ALIGN(sizeof(req));
        if (decode_nla && len > offset) {
                tprints(", ");
                decode_nlattr(tcp, addr + offset, len - offset,
@@ -456,7 +456,7 @@ DECL_NETLINK_DIAG_DECODER(decode_inet_diag_msg)
                tprints("...");
        tprints("}");
 
-       offset = NLA_ALIGN(sizeof(msg));
+       offset = NLMSG_ALIGN(sizeof(msg));
        if (decode_nla && len > offset) {
                tprints(", ");
                decode_nlattr(tcp, addr + offset, len - offset,
index b17d44fc3f6f0af346d40e471a04a2b0f8e8d502..65d419572c47f417151994b192c5634dfdb50106 100644 (file)
@@ -180,7 +180,7 @@ DECL_NETLINK_DIAG_DECODER(decode_netlink_diag_msg)
                tprints("...");
        tprints("}");
 
-       offset = NLA_ALIGN(sizeof(msg));
+       offset = NLMSG_ALIGN(sizeof(msg));
        if (decode_nla && len > offset) {
                tprints(", ");
                decode_nlattr(tcp, addr + offset, len - offset,
index 94eff1df839a48cea182d0e18c034dc840225135..8a69d4ccfd986c3c77556aef3833a6a0baf3669c 100644 (file)
@@ -199,7 +199,7 @@ DECL_NETLINK_DIAG_DECODER(decode_packet_diag_msg)
                tprints("...");
        tprints("}");
 
-       offset = NLA_ALIGN(sizeof(msg));
+       offset = NLMSG_ALIGN(sizeof(msg));
        if (decode_nla && len > offset) {
                tprints(", ");
                decode_nlattr(tcp, addr + offset, len - offset,
index 2cd07ee0008243415c36778064e9ccf8bbc96f3b..53ae27ba85442fc50fe9474fb2b75dfbf8d0c0d7 100644 (file)
@@ -177,7 +177,7 @@ DECL_NETLINK_DIAG_DECODER(decode_smc_diag_msg)
                tprints("...");
        tprints("}");
 
-       offset = NLA_ALIGN(sizeof(msg));
+       offset = NLMSG_ALIGN(sizeof(msg));
        if (decode_nla && len > offset) {
                tprints(", ");
                decode_nlattr(tcp, addr + offset, len - offset,