public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Xu, Baojun" <baojun.xu@ti.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: "robh+dt@kernel.org" <robh+dt@kernel.org>,
	"andriy.shevchenko@linux.intel.com"
	<andriy.shevchenko@linux.intel.com>,
	"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
	"perex@perex.cz" <perex@perex.cz>,
	"pierre-louis.bossart@linux.intel.com"
	<pierre-louis.bossart@linux.intel.com>,
	"Lu, Kevin" <kevin-lu@ti.com>,
	"Ding, Shenghao" <shenghao-ding@ti.com>,
	"Navada Kanyana, Mukund" <navada@ti.com>,
	"13916275206@139.com" <13916275206@139.com>,
	"Hampiholi, Vallabha" <v-hampiholi@ti.com>,
	"P O, Vijeth" <v-po@ti.com>,
	"Holalu Yogendra, Niranjan" <niranjan.hy@ti.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"liam.r.girdwood@intel.com" <liam.r.girdwood@intel.com>,
	"yung-chuan.liao@linux.intel.com"
	<yung-chuan.liao@linux.intel.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"soyer@irl.hu" <soyer@irl.hu>
Subject: Re: [EXTERNAL] Re: [PATCH v8] ALSA: hda/tas2781: Add tas2781 hda SPI driver
Date: Thu, 11 Jul 2024 09:42:08 +0000	[thread overview]
Message-ID: <cedb99db542a41178a5f1b09c9ef5cf3@ti.com> (raw)
In-Reply-To: <874j9v8xuq.wl-tiwai@suse.de>

Hi Takashi,

Answer in line.

Best Regards
Jim

> From: Takashi Iwai <tiwai@suse.de>
> Sent: 14 June 2024 21:20
> To: Xu, Baojun
> Cc: robh+dt@kernel.org; andriy.shevchenko@linux.intel.com; lgirdwood@gmail.com; perex@perex.cz; pierre-louis.bossart@linux.intel.com; Lu, Kevin; Ding, Shenghao; Navada Kanyana, Mukund; 13916275206@139.com; Hampiholi, Vallabha; P O, Vijeth; Holalu Yogendra, Niranjan; alsa-devel@alsa-project.org; linux-kernel@vger.kernel.org; liam.r.girdwood@intel.com; yung-chuan.liao@linux.intel.com; broonie@kernel.org; soyer@irl.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@list.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
> 
> 
> 

  reply	other threads:[~2024-07-11  9:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-14  4:05 [PATCH v8] ALSA: hda/tas2781: Add tas2781 hda SPI driver Baojun Xu
2024-06-14 13:20 ` Takashi Iwai
2024-07-11  9:42   ` Xu, Baojun [this message]
2024-06-14 14:38 ` Markus Elfring
2024-06-14 15:41 ` Christophe JAILLET
2024-06-18 11:01 ` Simon Trimmer
2024-07-11  9:02   ` [EXTERNAL] " Xu, Baojun

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=cedb99db542a41178a5f1b09c9ef5cf3@ti.com \
    --to=baojun.xu@ti.com \
    --cc=13916275206@139.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=kevin-lu@ti.com \
    --cc=lgirdwood@gmail.com \
    --cc=liam.r.girdwood@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=navada@ti.com \
    --cc=niranjan.hy@ti.com \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=robh+dt@kernel.org \
    --cc=shenghao-ding@ti.com \
    --cc=soyer@irl.hu \
    --cc=tiwai@suse.de \
    --cc=v-hampiholi@ti.com \
    --cc=v-po@ti.com \
    --cc=yung-chuan.liao@linux.intel.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