[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YLeowAzQPfJK3oap@smile.fi.intel.com>
Date: Wed, 2 Jun 2021 18:50:24 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Tian Tao <tiantao6@...ilicon.com>
Cc: gregkh@...uxfoundation.org, rafael@...nel.org,
akpm@...ux-foundation.org, jonathan.cameron@...wei.com,
song.bao.hua@...ilicon.com, linux-kernel@...r.kernel.org
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
Powered by blists - more mailing lists