summaryrefslogtreecommitdiff
path: root/fs/sysfs
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2008-03-04 15:09:07 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2008-03-24 22:33:49 -0700
commit815d2d50da41f28aae58f5e9b3c61c3094422749 (patch)
treef5c3a8f1cd676ef7ed76ea6cc96ccf399310f7fb /fs/sysfs
parentc9698d6b1a90929e427a165bd8283f803f57d9bd (diff)
downloadlinux-3.10-815d2d50da41f28aae58f5e9b3c61c3094422749.tar.gz
linux-3.10-815d2d50da41f28aae58f5e9b3c61c3094422749.tar.bz2
linux-3.10-815d2d50da41f28aae58f5e9b3c61c3094422749.zip
driver core: debug for bad dev_attr_show() return value.
Try to find the culprit who caused http://bugzilla.kernel.org/show_bug.cgi?id=10150 Cc: <balajirrao@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/sysfs')
-rw-r--r--fs/sysfs/file.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index a271c87c447..baa663e6938 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -12,6 +12,7 @@
#include <linux/module.h>
#include <linux/kobject.h>
+#include <linux/kallsyms.h>
#include <linux/namei.h>
#include <linux/poll.h>
#include <linux/list.h>
@@ -86,7 +87,12 @@ static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer
* The code works fine with PAGE_SIZE return but it's likely to
* indicate truncated result or overflow in normal use cases.
*/
- BUG_ON(count >= (ssize_t)PAGE_SIZE);
+ if (count >= (ssize_t)PAGE_SIZE) {
+ print_symbol("fill_read_buffer: %s returned bad count\n",
+ (unsigned long)ops->show);
+ /* Try to struggle along */
+ count = PAGE_SIZE - 1;
+ }
if (count >= 0) {
buffer->needs_read_fill = 0;
buffer->count = count;