2017-12-14 01:21:17

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH v2 08/16] remoteproc: add name in rproc_mem_entry struct

On Thu 30 Nov 08:46 PST 2017, Loic Pallardy wrote:

> Add name field in struc rproc_mem_entry.
> This new field will be used to match memory area
> requested in resource table with pre-registered carveout.
>
> Signed-off-by: Loic Pallardy <[email protected]>
> ---
> drivers/remoteproc/remoteproc_core.c | 1 +
> drivers/remoteproc/remoteproc_debugfs.c | 1 +
> include/linux/remoteproc.h | 2 ++
> 3 files changed, 4 insertions(+)
>
> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> index bdc99cd..cc53247 100644
> --- a/drivers/remoteproc/remoteproc_core.c
> +++ b/drivers/remoteproc/remoteproc_core.c
> @@ -835,6 +835,7 @@ static int rproc_handle_carveout(struct rproc *rproc,
> carveout->da = rsc->da;
> carveout->release = rproc_release_carveout;
> carveout->priv = (void *)CARVEOUT_RSC_ALLOCATED;
> + strncpy(carveout->name, rsc->name, sizeof(carveout->name));

Please ensure that this string is NUL terminated.

Regards,
Bjorn


2018-01-12 08:19:56

by Loic Pallardy

[permalink] [raw]
Subject: RE: [PATCH v2 08/16] remoteproc: add name in rproc_mem_entry struct



> -----Original Message-----
> From: Bjorn Andersson [mailto:[email protected]]
> Sent: Thursday, December 14, 2017 2:21 AM
> To: Loic PALLARDY <[email protected]>
> Cc: [email protected]; [email protected]; linux-
> [email protected]; Arnaud POULIQUEN <[email protected]>;
> [email protected]
> Subject: Re: [PATCH v2 08/16] remoteproc: add name in rproc_mem_entry
> struct
>
> On Thu 30 Nov 08:46 PST 2017, Loic Pallardy wrote:
>
> > Add name field in struc rproc_mem_entry.
> > This new field will be used to match memory area
> > requested in resource table with pre-registered carveout.
> >
> > Signed-off-by: Loic Pallardy <[email protected]>
> > ---
> > drivers/remoteproc/remoteproc_core.c | 1 +
> > drivers/remoteproc/remoteproc_debugfs.c | 1 +
> > include/linux/remoteproc.h | 2 ++
> > 3 files changed, 4 insertions(+)
> >
> > diff --git a/drivers/remoteproc/remoteproc_core.c
> b/drivers/remoteproc/remoteproc_core.c
> > index bdc99cd..cc53247 100644
> > --- a/drivers/remoteproc/remoteproc_core.c
> > +++ b/drivers/remoteproc/remoteproc_core.c
> > @@ -835,6 +835,7 @@ static int rproc_handle_carveout(struct rproc
> *rproc,
> > carveout->da = rsc->da;
> > carveout->release = rproc_release_carveout;
> > carveout->priv = (void *)CARVEOUT_RSC_ALLOCATED;
> > + strncpy(carveout->name, rsc->name, sizeof(carveout->name));
>
> Please ensure that this string is NUL terminated.

I'll use strlcpy instead

Regards,
Loic
>
> Regards,
> Bjorn