lkml.org 
[lkml]   [2021]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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


\
 
 \ /
  Last update: 2021-06-02 17:51    [W:0.992 / U:0.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site