[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <cedb99db542a41178a5f1b09c9ef5cf3@ti.com>
Date: Thu, 11 Jul 2024 09:42:08 +0000
From: "Xu, Baojun" <baojun.xu@...com>
To: Takashi Iwai <tiwai@...e.de>
CC: "robh+dt@...nel.org" <robh+dt@...nel.org>,
"andriy.shevchenko@...ux.intel.com" <andriy.shevchenko@...ux.intel.com>,
"lgirdwood@...il.com" <lgirdwood@...il.com>,
"perex@...ex.cz"
<perex@...ex.cz>,
"pierre-louis.bossart@...ux.intel.com"
<pierre-louis.bossart@...ux.intel.com>,
"Lu, Kevin" <kevin-lu@...com>,
"Ding,
Shenghao" <shenghao-ding@...com>,
"Navada Kanyana, Mukund" <navada@...com>,
"13916275206@....com" <13916275206@....com>,
"Hampiholi, Vallabha"
<v-hampiholi@...com>,
"P O, Vijeth" <v-po@...com>,
"Holalu Yogendra,
Niranjan" <niranjan.hy@...com>,
"alsa-devel@...a-project.org"
<alsa-devel@...a-project.org>,
"linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>,
"liam.r.girdwood@...el.com"
<liam.r.girdwood@...el.com>,
"yung-chuan.liao@...ux.intel.com"
<yung-chuan.liao@...ux.intel.com>,
"broonie@...nel.org" <broonie@...nel.org>,
"soyer@....hu" <soyer@....hu>
Subject: Re: [EXTERNAL] Re: [PATCH v8] ALSA: hda/tas2781: Add tas2781 hda SPI
driver
Hi Takashi,
Answer in line.
Best Regards
Jim
> From: Takashi Iwai <tiwai@...e.de>
> Sent: 14 June 2024 21:20
> To: Xu, Baojun
> Cc: robh+dt@...nel.org; andriy.shevchenko@...ux.intel.com; lgirdwood@...il.com; perex@...ex.cz; pierre-louis.bossart@...ux.intel.com; Lu, Kevin; Ding, Shenghao; Navada Kanyana, Mukund; 13916275206@....com; Hampiholi, Vallabha; P O, Vijeth; Holalu Yogendra, Niranjan; alsa-devel@...a-project.org; linux-kernel@...r.kernel.org; liam.r.girdwood@...el.com; yung-chuan.liao@...ux.intel.com; broonie@...nel.org; soyer@....hu
> Subject: [EXTERNAL] Re: [PATCH v8] ALSA: hda/tas2781: Add tas2781 hda SPI driver
>
> On Fri, 14 Jun 2024 06: 05: 54 +0200, Baojun Xu wrote: > +static struct tasdevice_config_info *tasdevice_add_config( > + struct tasdevice_priv *tas_priv, unsigned char *config_data, > + unsigned int config_size, int *status) > +{
> ZjQcmQRYFpfptBannerStart
> This message was sent from outside of Texas Instruments.
> Do not click links or open attachments unless you recognize the source of this email and know the content is safe. If you wish to report this message to IT Security, please forward the message as an attachment to phishing@...t.ti.com
>
> ZjQcmQRYFpfptBannerEnd
>
> On Fri, 14 Jun 2024 06:05:54 +0200,
> Baojun Xu wrote:
> > +static struct tasdevice_config_info *tasdevice_add_config(
> > + struct tasdevice_priv *tas_priv, unsigned char *config_data,
> > + unsigned int config_size, int *status)
> > +{
> (snip)
> > + /*
> > + * convert data[offset], data[offset + 1], data[offset + 2] and
> > + * data[offset + 3] into host
> > + */
> > + cfg_info->nblocks = get_unaligned_be32(&config_data[config_offset]);
> > + config_offset += 4;
> > +
> > + /*
> > + * Several kinds of dsp/algorithm firmwares can run on tas2781,
> > + * the number and size of blk are not fixed and different among
> > + * these firmwares.
> > + */
> > + bk_da = cfg_info->blk_data = kcalloc(cfg_info->nblocks,
> > + sizeof(*bk_da), GFP_KERNEL);
>
> So the allocation size relies on the firmware data content, and it can
> practically any value. It'd be safer to have some sanity check for
> avoiding the allocation of too large pages.
> Ditto for other allocations in this code; you should never trust the
> firmware binary.
It's just size of struct tasdev_blk_data, not variable from firmware.
In other kcalloc(), it's also allocate memory for structure.
>
> Also, in general, the comments are missing for functions in
> tas2781_spi_fwlib.c completely. A brief comment for each function
> would be helpful for readers.
>
>
> thanks,
>
> Takashi
>
>
>
Powered by blists - more mailing lists