public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Tian Tao <tiantao6@hisilicon.com>
Cc: gregkh@linuxfoundation.org, rafael@kernel.org,
	akpm@linux-foundation.org, jonathan.cameron@huawei.com,
	song.bao.hua@hisilicon.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] drivers/base/node.c: use bin_attribute to avoid buff overflow
Date: Wed, 2 Jun 2021 18:50:24 +0300	[thread overview]
Message-ID: <YLeowAzQPfJK3oap@smile.fi.intel.com> (raw)
In-Reply-To: <1622641734-22538-4-git-send-email-tiantao6@hisilicon.com>

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



  reply	other threads:[~2021-06-02 15:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02 13:48 [PATCH v2 0/3] use bin_attribute to avoid buff overflow Tian Tao
2021-06-02 13:48 ` [PATCH v2 1/3] lib: bitmap: introduce bitmap_print_to_buf Tian Tao
2021-06-02 14:22   ` Jonathan Cameron
2021-06-02 15:47   ` Andy Shevchenko
2021-06-02 13:48 ` [PATCH v2 2/3] topology: use bin_attribute to avoid buff overflow Tian Tao
2021-06-02 15:48   ` Andy Shevchenko
2021-06-02 13:48 ` [PATCH v2 3/3] drivers/base/node.c: " Tian Tao
2021-06-02 15:50   ` Andy Shevchenko [this message]
2021-06-02 15:42 ` [PATCH v2 0/3] " Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YLeowAzQPfJK3oap@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=song.bao.hua@hisilicon.com \
    --cc=tiantao6@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox