diff options
author | Jan Kara <jack@suse.cz> | 2007-12-22 17:03:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-12-23 15:54:36 -0500 |
commit | 22dd483721939b4ea22d5d3925e69112f63c42bc (patch) | |
tree | 9107a4fec871b4798971ca377c044a9d5f783d42 | |
parent | b88629060b03adc58639f818fe0968bf5fe81b5d (diff) |
Fix computation of SKB size for quota messages
Fix computation of size of skb needed for quota message. We should use
netlink provided functions and not just an ad-hoc number. Also don't print
the return value from nla_put_foo() as it is always -1.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/dquot.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/dquot.c b/fs/dquot.c index 686ab63a7c6c..b2592abaa713 100644 --- a/fs/dquot.c +++ b/fs/dquot.c | |||
@@ -895,9 +895,6 @@ out_lock: | |||
895 | 895 | ||
896 | #ifdef CONFIG_QUOTA_NETLINK_INTERFACE | 896 | #ifdef CONFIG_QUOTA_NETLINK_INTERFACE |
897 | 897 | ||
898 | /* Size of quota netlink message - actually an upperbound for buffer size */ | ||
899 | #define QUOTA_NL_MSG_SIZE 32 | ||
900 | |||
901 | /* Netlink family structure for quota */ | 898 | /* Netlink family structure for quota */ |
902 | static struct genl_family quota_genl_family = { | 899 | static struct genl_family quota_genl_family = { |
903 | .id = GENL_ID_GENERATE, | 900 | .id = GENL_ID_GENERATE, |
@@ -914,11 +911,13 @@ static void send_warning(const struct dquot *dquot, const char warntype) | |||
914 | struct sk_buff *skb; | 911 | struct sk_buff *skb; |
915 | void *msg_head; | 912 | void *msg_head; |
916 | int ret; | 913 | int ret; |
914 | int msg_size = 4 * nla_total_size(sizeof(u32)) + | ||
915 | 2 * nla_total_size(sizeof(u64)); | ||
917 | 916 | ||
918 | /* We have to allocate using GFP_NOFS as we are called from a | 917 | /* We have to allocate using GFP_NOFS as we are called from a |
919 | * filesystem performing write and thus further recursion into | 918 | * filesystem performing write and thus further recursion into |
920 | * the fs to free some data could cause deadlocks. */ | 919 | * the fs to free some data could cause deadlocks. */ |
921 | skb = genlmsg_new(QUOTA_NL_MSG_SIZE, GFP_NOFS); | 920 | skb = genlmsg_new(msg_size, GFP_NOFS); |
922 | if (!skb) { | 921 | if (!skb) { |
923 | printk(KERN_ERR | 922 | printk(KERN_ERR |
924 | "VFS: Not enough memory to send quota warning.\n"); | 923 | "VFS: Not enough memory to send quota warning.\n"); |
@@ -959,7 +958,7 @@ static void send_warning(const struct dquot *dquot, const char warntype) | |||
959 | "VFS: Failed to send notification message: %d\n", ret); | 958 | "VFS: Failed to send notification message: %d\n", ret); |
960 | return; | 959 | return; |
961 | attr_err_out: | 960 | attr_err_out: |
962 | printk(KERN_ERR "VFS: Failed to compose quota message: %d\n", ret); | 961 | printk(KERN_ERR "VFS: Not enough space to compose quota message!\n"); |
963 | err_out: | 962 | err_out: |
964 | kfree_skb(skb); | 963 | kfree_skb(skb); |
965 | } | 964 | } |