Showing error 1769

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: mm/backing-dev.c
Line in file: 165
Project: Linux Kernel
Project version: 2.6.28
Confirmation: Fixed by 144214537370b4f133a735446ebe86e90cfb2501
Tools: Smatch (1.59)
Entered: 2013-09-10 20:24:52 UTC


Source:

135static ssize_t max_ratio_store(struct device *dev,
136                struct device_attribute *attr, const char *buf, size_t count)
137{
138        struct backing_dev_info *bdi = dev_get_drvdata(dev);
139        char *end;
140        unsigned int ratio;
141        ssize_t ret = -EINVAL;
142
143        ratio = simple_strtoul(buf, &end, 10);
144        if (*buf && (end[0] == '\0' || (end[0] == '\n' && end[1] == '\0'))) {
145                ret = bdi_set_max_ratio(bdi, ratio);
146                if (!ret)
147                        ret = count;
148        }
149        return ret;
150}
151BDI_SHOW(max_ratio, bdi->max_ratio)
152
153#define __ATTR_RW(attr) __ATTR(attr, 0644, attr##_show, attr##_store)
154
155static struct device_attribute bdi_dev_attrs[] = {
156        __ATTR_RW(read_ahead_kb),
157        __ATTR_RW(min_ratio),
158        __ATTR_RW(max_ratio),
159        __ATTR_NULL,
160};
161
162static __init int bdi_class_init(void)
163{
164        bdi_class = class_create(THIS_MODULE, "bdi");
165        bdi_class->dev_attrs = bdi_dev_attrs;
166        bdi_debug_init();
167        return 0;
168}
169
170postcore_initcall(bdi_class_init);
171
172int bdi_register(struct backing_dev_info *bdi, struct device *parent,
173                const char *fmt, ...)
174{
175        va_list args;
Show full sources