summaryrefslogtreecommitdiffstats
path: root/Documentation/accounting
diff options
context:
space:
mode:
authorNicolas Dichtel <nicolas.dichtel@6wind.com>2016-04-27 17:53:08 +0200
committerDavid S. Miller <davem@davemloft.net>2016-04-27 12:50:14 -0400
commit570d8e9398011a63590c281a36cdce311196608e (patch)
treec11f34750ad1786576433edcff3cfad23582c139 /Documentation/accounting
parent0e7dd0c9c3cde901f79f04260aa706bbfdc0c67e (diff)
downloadop-kernel-dev-570d8e9398011a63590c281a36cdce311196608e.zip
op-kernel-dev-570d8e9398011a63590c281a36cdce311196608e.tar.gz
taskstats: fix nl parsing in accounting/getdelays.c
The type TASKSTATS_TYPE_NULL should always be ignored. When jumping to the next attribute, only the length of the current attribute should be added, not the length of all nested attributes. This last bug was not visible before commit 80df554275c2, because the kernel didn't put more than two nested attributes. Fixes: a3baf649ca9c ("[PATCH] per-task-delay-accounting: documentation") Fixes: 80df554275c2 ("taskstats: use the libnl API to align nlattr on 64-bit") Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'Documentation/accounting')
-rw-r--r--Documentation/accounting/getdelays.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
index 7785fb5..b5ca536 100644
--- a/Documentation/accounting/getdelays.c
+++ b/Documentation/accounting/getdelays.c
@@ -505,6 +505,8 @@ int main(int argc, char *argv[])
if (!loop)
goto done;
break;
+ case TASKSTATS_TYPE_NULL:
+ break;
default:
fprintf(stderr, "Unknown nested"
" nla_type %d\n",
@@ -512,7 +514,8 @@ int main(int argc, char *argv[])
break;
}
len2 += NLA_ALIGN(na->nla_len);
- na = (struct nlattr *) ((char *) na + len2);
+ na = (struct nlattr *)((char *)na +
+ NLA_ALIGN(na->nla_len));
}
break;
OpenPOWER on IntegriCloud