From: Balbir Singh <balbir@in.ibm.com>
To: akpm@osdl.org
Cc: Jamal Hadi <hadi@cyberus.ca>,
Shailabh Nagar <nagar@watson.ibm.com>,
Thomas Graf <tgraf@suug.ch>,
netdev@vger.kernel.org, Balbir Singh <balbir@in.ibm.com>,
linux-kernel@vger.kernel.org
Subject: [RFC][PATCH -mm] Fix getdelays.c - cpumask length and error reporting.
Date: Mon, 11 Sep 2006 13:10:43 +0530 [thread overview]
Message-ID: <20060911074043.26844.94895.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20060911074021.26844.70576.sendpatchset@localhost.localdomain>
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: Balbir Singh <balbir@in.ibm.com>
---
Documentation/accounting/getdelays.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff -puN Documentation/accounting/getdelays.c~taskstats-fix-delayacct-utility Documentation/accounting/getdelays.c
--- linux-2.6.18-rc6/Documentation/accounting/getdelays.c~taskstats-fix-delayacct-utility 2006-09-11 12:43:50.000000000 +0530
+++ linux-2.6.18-rc6-balbir/Documentation/accounting/getdelays.c 2006-09-11 12:46:57.000000000 +0530
@@ -285,7 +285,7 @@ int main(int argc, char *argv[])
if (maskset) {
rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET,
TASKSTATS_CMD_ATTR_REGISTER_CPUMASK,
- &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,
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK,
- &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");
_
--
Balbir Singh,
Linux Technology Center,
IBM Software Labs
prev parent reply other threads:[~2006-09-11 7:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-11 7:40 [RFC][PATCH -mm] Add genetlink utilities for payload length calculation Balbir Singh
2006-09-11 7:40 ` [RFC][PATCH -mm] Fix taskstats size calculation (use the new genetlink utility functions) Balbir Singh
2006-09-11 7:40 ` Balbir Singh [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060911074043.26844.94895.sendpatchset@localhost.localdomain \
--to=balbir@in.ibm.com \
--cc=akpm@osdl.org \
--cc=hadi@cyberus.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=nagar@watson.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=tgraf@suug.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox