RE: [PATCH v4 2/4] topology: use bin_attribute to avoid buff overflow
From: Song Bao Hua (Barry Song)
Date: Thu Jun 17 2021 - 07:03:45 EST
> -----Original Message-----
> From: Greg KH [mailto:gregkh@xxxxxxxxxxxxxxxxxxx]
> Sent: Thursday, June 17, 2021 10:56 PM
> To: Song Bao Hua (Barry Song) <song.bao.hua@xxxxxxxxxxxxx>
> Cc: andriy.shevchenko@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx;
> linux@xxxxxxxxxxxxxxxxxx; rafael@xxxxxxxxxx; akpm@xxxxxxxxxxxxxxxxxxxx;
> rdunlap@xxxxxxxxxxxxx; agordeev@xxxxxxxxxxxxx; sbrivio@xxxxxxxxxx;
> jianpeng.ma@xxxxxxxxx; yury.norov@xxxxxxxxx; valentin.schneider@xxxxxxx;
> peterz@xxxxxxxxxxxxx; bristot@xxxxxxxxxx; guodong.xu@xxxxxxxxxx;
> tangchengchang <tangchengchang@xxxxxxxxxx>; Zengtao (B)
> <prime.zeng@xxxxxxxxxxxxx>; yangyicong <yangyicong@xxxxxxxxxx>;
> tim.c.chen@xxxxxxxxxxxxxxx; tiantao (H) <tiantao6@xxxxxxxxxxxxx>; Jonathan
> Cameron <jonathan.cameron@xxxxxxxxxx>; Linuxarm <linuxarm@xxxxxxxxxx>
> Subject: Re: [PATCH v4 2/4] topology: use bin_attribute to avoid buff overflow
>
> On Thu, Jun 17, 2021 at 10:19:08PM +1200, Barry Song wrote:
> > From: Tian Tao <tiantao6@xxxxxxxxxxxxx>
> >
> > Reading sys/devices/system/cpu/cpuX/topology/ returns cpu topology.
> > 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.
> >
> > Link:
> https://lore.kernel.org/lkml/20210319041618.14316-2-song.bao.hua@hisilicon
> .com/
> > Signed-off-by: Tian Tao <tiantao6@xxxxxxxxxxxxx>
> > Reviewed-by: Jonathan Cameron <jonathan.cameron@xxxxxxxxxx>
> > Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> > Cc: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
>
> As with the other patch, you have to also sign off on this as well.
>
Ok. Will add my s-o-b for patch 1-3.
> The link is pointing to a v5 of a different patch series, why put that
> here?
This patchset originated from the discussion of that one in the
link tag.
Jonathan and me were trying to add a cluster topology level.
And that one exposed the problem this patchset is addressing.
>
> thanks,
>
> greg k-h
Thanks
Barry