summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorMeher Chaitanya P <mchaitanyap@nvidia.com>2012-10-04 23:16:52 +0530
committerSimone Willett <swillett@nvidia.com>2012-10-25 17:49:19 -0700
commitfdc6068570e6249e878b7cae97b99ae9956610a8 (patch)
tree5fa863dfaafdadd744ade1162b72820922f9855d /net
parent944ae0f2548d235eb975a111b484fbaba04644c9 (diff)
net: stats: Fix the ENOMEM issue in reading stats proc interface.
Fixing the bug that cat /proc/net/stat/activity always returns ENOMEM. Bug 1056071. Reviewed-on: http://git-master/r/141596 Signed-off-by: Meher Chaitanya P <mchaitanyap@nvidia.com> Change-Id: I7cf0824b7ad77e9af3b916b075d2a35918b177dc Reviewed-on: http://git-master/r/145497 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Sandeep Trasi <strasi@nvidia.com> Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com> Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Diffstat (limited to 'net')
-rw-r--r--net/activity_stats.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/net/activity_stats.c b/net/activity_stats.c
index 8a3e93470069..6e8a9dc3c579 100644
--- a/net/activity_stats.c
+++ b/net/activity_stats.c
@@ -2,6 +2,8 @@
*
* Copyright (C) 2010 Google, Inc.
*
+ * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
+ *
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
@@ -26,7 +28,7 @@
* N seconds apart, where N is 1 << bucket index.
*/
#define BUCKET_MAX 10
-
+#define BUFFSIZE (30 * BUCKET_MAX + 22)
/* Track network activity frequency */
static unsigned long activity_stats[BUCKET_MAX];
static ktime_t last_transmit;
@@ -67,7 +69,13 @@ static int activity_stats_read_proc(char *page, char **start, off_t off,
char *p = page;
/* Only print if offset is 0, or we have enough buffer space */
- if (off || count < (30 * BUCKET_MAX + 22))
+
+ if (off != 0) {
+ *eof = 1;
+ return 0;
+ }
+
+ else if (count < BUFFSIZE)
return -ENOMEM;
len = snprintf(p, count, "Min Bucket(sec) Count\n");