[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YLW/DZBYOcYxzRaK@kroah.com>
Date: Tue, 1 Jun 2021 07:01:01 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Tian Tao <tiantao6@...ilicon.com>
Cc: linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
song.bao.hua@...ilicon.com, "Rafael J. Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH 2/2] drivers/base/node.c: use bin_attribute to avoid buff
overflow
On Tue, Jun 01, 2021 at 10:56:50AM +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.
>
> Signed-off-by: Tian Tao <tiantao6@...ilicon.com>
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Cc: "Rafael J. Wysocki" <rafael@...nel.org>
> ---
> drivers/base/node.c | 49 +++++++++++++++++++++++++++++++------------------
> 1 file changed, 31 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/base/node.c b/drivers/base/node.c
> index f449dbb..a19be64 100644
> --- a/drivers/base/node.c
> +++ b/drivers/base/node.c
> @@ -27,42 +27,42 @@ static struct bus_type node_subsys = {
> };
>
>
> -static ssize_t node_read_cpumap(struct device *dev, bool list, char *buf)
> +static ssize_t node_read_cpumap(struct kobject *kobj, bool list,
Why not stick with the dev pointer here? These are devices, please use
them.
thanks,
greg k-h
Powered by blists - more mailing lists