diff options
| -rw-r--r-- | drivers/base/core.c | 5 | ||||
| -rw-r--r-- | fs/sysfs/file.c | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index 7de543d1d0b4..24198ad01976 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/kdev_t.h> | 19 | #include <linux/kdev_t.h> |
| 20 | #include <linux/notifier.h> | 20 | #include <linux/notifier.h> |
| 21 | #include <linux/genhd.h> | 21 | #include <linux/genhd.h> |
| 22 | #include <linux/kallsyms.h> | ||
| 22 | #include <asm/semaphore.h> | 23 | #include <asm/semaphore.h> |
| 23 | 24 | ||
| 24 | #include "base.h" | 25 | #include "base.h" |
| @@ -68,6 +69,10 @@ static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr, | |||
| 68 | 69 | ||
| 69 | if (dev_attr->show) | 70 | if (dev_attr->show) |
| 70 | ret = dev_attr->show(dev, dev_attr, buf); | 71 | ret = dev_attr->show(dev, dev_attr, buf); |
| 72 | if (ret >= (ssize_t)PAGE_SIZE) { | ||
| 73 | print_symbol("dev_attr_show: %s returned bad count\n", | ||
| 74 | (unsigned long)dev_attr->show); | ||
| 75 | } | ||
| 71 | return ret; | 76 | return ret; |
| 72 | } | 77 | } |
| 73 | 78 | ||
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index a271c87c4472..baa663e69388 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
| 14 | #include <linux/kobject.h> | 14 | #include <linux/kobject.h> |
| 15 | #include <linux/kallsyms.h> | ||
| 15 | #include <linux/namei.h> | 16 | #include <linux/namei.h> |
| 16 | #include <linux/poll.h> | 17 | #include <linux/poll.h> |
| 17 | #include <linux/list.h> | 18 | #include <linux/list.h> |
| @@ -86,7 +87,12 @@ static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer | |||
| 86 | * The code works fine with PAGE_SIZE return but it's likely to | 87 | * The code works fine with PAGE_SIZE return but it's likely to |
| 87 | * indicate truncated result or overflow in normal use cases. | 88 | * indicate truncated result or overflow in normal use cases. |
| 88 | */ | 89 | */ |
| 89 | BUG_ON(count >= (ssize_t)PAGE_SIZE); | 90 | if (count >= (ssize_t)PAGE_SIZE) { |
| 91 | print_symbol("fill_read_buffer: %s returned bad count\n", | ||
| 92 | (unsigned long)ops->show); | ||
| 93 | /* Try to struggle along */ | ||
| 94 | count = PAGE_SIZE - 1; | ||
| 95 | } | ||
| 90 | if (count >= 0) { | 96 | if (count >= 0) { |
| 91 | buffer->needs_read_fill = 0; | 97 | buffer->needs_read_fill = 0; |
| 92 | buffer->count = count; | 98 | buffer->count = count; |
