Messages in this thread | | | Date | Wed, 2 Jun 2021 18:50:24 +0300 | From | Andy Shevchenko <> | Subject | Re: [PATCH v2 3/3] drivers/base/node.c: use bin_attribute to avoid buff overflow |
| |
On Wed, Jun 02, 2021 at 09:48:54PM +0800, Tian Tao wrote: > Reading sys/devices/system/cpu/cpuX/nodeX/ returns cpumap and cpulist. > However, the size of this file is limited to PAGE_SIZE because of the > limitation for sysfs attribute. so we use bin_attribute instead of > attribute to avoid NR_CPUS too big to cause buff overflow.
...
> -static ssize_t node_read_cpumap(struct device *dev, bool list, char *buf) > +static ssize_t node_read_cpumap(struct device *dev, bool list, > + char *buf, loff_t off, size_t count)
Why you moved char *buf to the next line? Replacing ) by , doesn't change character count. Perhaps you need to reconfigure your editor.
...
> +static struct bin_attribute *node_dev_bin_attrs[] = { > + &bin_attr_cpumap, > + &bin_attr_cpulist,
> + NULL,
No comma.
> +};
...
> +static const struct attribute_group *node_dev_groups[] = { > + &node_dev_group, > + NULL,
Ditto.
> +};
-- With Best Regards, Andy Shevchenko
| |