Commit 7d1bdca9 authored by Balbir Singh's avatar Balbir Singh Committed by Linus Torvalds
Browse files

[PATCH] Fix getdelays.c - cpumask length and error reporting

Fix the length passed while (un)registering cpumask.  We were passing sizeof
the array, make it strlen().

Error value printed in fatal errors should be derived from the message.  The
message contains an nlmsgerr embedded with an error value.  We must report
that value to the user.
Signed-off-by: default avatarBalbir Singh <>
Cc: Jamal Hadi <>
Cc: Shailabh Nagar <>
Cc: Thomas Graf <>
Cc: "David S. Miller" <>
Cc: Jay Lan <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 0ae64684
......@@ -285,7 +285,7 @@ int main(int argc, char *argv[])
if (maskset) {
rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET,
&cpumask, sizeof(cpumask));
&cpumask, strlen(cpumask) + 1);
PRINTF("Sent register cpumask, retval %d\n", rc);
if (rc < 0) {
printf("error sending register cpumask\n");
......@@ -315,7 +315,8 @@ int main(int argc, char *argv[])
if (msg.n.nlmsg_type == NLMSG_ERROR ||
!NLMSG_OK((&msg.n), rep_len)) {
printf("fatal reply error, errno %d\n", errno);
struct nlmsgerr *err = NLMSG_DATA(&msg);
printf("fatal reply error, errno %d\n", err->error);
goto done;
......@@ -383,7 +384,7 @@ done:
if (maskset) {
rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET,
&cpumask, sizeof(cpumask));
&cpumask, strlen(cpumask) + 1);
printf("Sent deregister mask, retval %d\n", rc);
if (rc < 0)
err(rc, "error sending deregister cpumask\n");
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment