public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Balbir Singh <balbir@in.ibm.com>
To: akpm@osdl.org
Cc: Balbir Singh <balbir@in.ibm.com>, Jamal Hadi <hadi@cyberus.ca>,
	Thomas Graf <tgraf@suug.ch>,
	netdev@vger.kernel.org, Shailabh Nagar <nagar@watson.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: [RFC][PATCH -mm] Fix taskstats size calculation (use the new genetlink utility functions)
Date: Mon, 11 Sep 2006 13:10:32 +0530	[thread overview]
Message-ID: <20060911074032.26844.3566.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20060911074021.26844.70576.sendpatchset@localhost.localdomain>



The addition of the CSA patch pushed the size of struct taskstats to 256
bytes. This exposed a problem with prepare_reply(), we were not allocating
space for the netlink and genetlink header. It worked earlier because
alloc_skb() would align the skb to SMP_CACHE_BYTES, which added some additonal
bytes.

Signed-off-by: Balbir Singh <balbir@in.ibm.com>
---

 kernel/taskstats.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN kernel/taskstats.c~taskstats-fix-msg-size kernel/taskstats.c
--- linux-2.6.18-rc6/kernel/taskstats.c~taskstats-fix-msg-size	2006-09-11 11:42:40.000000000 +0530
+++ linux-2.6.18-rc6-balbir/kernel/taskstats.c	2006-09-11 11:42:55.000000000 +0530
@@ -77,7 +77,7 @@ static int prepare_reply(struct genl_inf
 	/*
 	 * If new attributes are added, please revisit this allocation
 	 */
-	skb = nlmsg_new(size, GFP_KERNEL);
+	skb = nlmsg_new(genlmsg_total_size(size), GFP_KERNEL);
 	if (!skb)
 		return -ENOMEM;
 
_

-- 

	Balbir Singh,
	Linux Technology Center,
	IBM Software Labs

  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 ` Balbir Singh [this message]
2006-09-11  7:40 ` [RFC][PATCH -mm] Fix getdelays.c - cpumask length and error reporting Balbir Singh

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=20060911074032.26844.3566.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