Re: [PATCH 1/2] topology: use bin_attribute to avoid buff overflow
From: Greg KH
Date: Tue Jun 01 2021 - 03:13:51 EST
On Tue, Jun 01, 2021 at 07:04:33AM +0000, Song Bao Hua (Barry Song) wrote:
>
>
> > -----Original Message-----
> > From: Greg KH [mailto:gregkh@xxxxxxxxxxxxxxxxxxx]
> > Sent: Tuesday, June 1, 2021 4:59 PM
> > To: tiantao (H) <tiantao6@xxxxxxxxxxxxx>
> > Cc: linux-kernel@xxxxxxxxxxxxxxx; akpm@xxxxxxxxxxxxxxxxxxxx; Song Bao Hua
> > (Barry Song) <song.bao.hua@xxxxxxxxxxxxx>; Andy Shevchenko
> > <andriy.shevchenko@xxxxxxxxxxxxxxx>; Rafael J. Wysocki <rafael@xxxxxxxxxx>
> > Subject: Re: [PATCH 1/2] topology: use bin_attribute to avoid buff overflow
> >
> > On Tue, Jun 01, 2021 at 10:56:49AM +0800, Tian Tao wrote:
> > > 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.
> > >
> > > This patch is based on the following discussion.
> > > https://www.spinics.net/lists/linux-doc/msg95921.html
> >
> > Please use lore.kernel.org for links as we have no control over other
> > sites to ensure that they will work in the future. Use the message id
> > in the link as well, so that if something were to happen to lore, we can
> > figure it out.
> >
> > Also, you are modifying a bunch of different files here, do you mean to
> > do it for all of them?
>
> The plan is providing a common wrapper similar with cpumap_print_to_pagebuf
> so that all modules which have bitmap and list topology ABI can move to use
> it.
Ok, then create the new function and then convert to use it, do not
bundle it together in the same patch.
thanks,
greg k-h