[alsa-devel] [PATCH 3/3] topology: Check address and length before string copy

Lin, Mengdong mengdong.lin at intel.com
Tue Jul 19 17:10:30 CEST 2016


> -----Original Message-----
> From: Takashi Sakamoto [mailto:o-takashi at sakamocchi.jp]
> Sent: Tuesday, July 19, 2016 5:45 PM
> To: mengdong.lin at linux.intel.com; alsa-devel at alsa-project.org;
> broonie at kernel.org
> Cc: tiwai at suse.de; Girdwood, Liam R; Lin, Mengdong
> Subject: Re: [PATCH 3/3] topology: Check address and length before string
> copy
> 
> Hi,
> 
> On Jul 19 2016 17:52, mengdong.lin at linux.intel.com wrote:
> > From: Mengdong Lin <mengdong.lin at linux.intel.com>
> >
> > Signed-off-by: Mengdong Lin <mengdong.lin at linux.intel.com>
> 
> The cover letter addresses this patch fixes a compiler warning. In this case,
> it's better to write the message in commit message, I think. Like:
> http://mailman.alsa-project.org/pipermail/alsa-devel/2016-July/110097.ht
> ml
> 
> This is not just from my taste. Maintainers prefer. At least, blank commit
> messages are not preferrable in general.

Yes, that would be better. I'll fix this in v2 tomorrow.

Thanks
Mengdong

> 
> > diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h
> > index 4d79aa7..cfde4cc 100644
> > --- a/src/topology/tplg_local.h
> > +++ b/src/topology/tplg_local.h
> > @@ -253,6 +253,9 @@ struct tplg_elem*
> tplg_elem_new_common(snd_tplg_t
> > *tplg,
> >
> >   static inline void elem_copy_text(char *dest, const char *src, int len)
> >   {
> > +	if (!dest || !src || !len)
> > +		return;
> > +
> >   	strncpy(dest, src, len);
> >   	dest[len - 1] = 0;
> >   }
> 
> 
> Regards
> 
> Takashi Sakamoto


More information about the Alsa-devel mailing list