lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z5D50Wy6R6FuxSzG@bogus>
Date: Wed, 22 Jan 2025 13:59:45 +0000
From: Sudeep Holla <sudeep.holla@....com>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: Cristian Marussi <cristian.marussi@....com>,
	Sudeep Holla <sudeep.holla@....com>,
	"Peng Fan (OSS)" <peng.fan@....nxp.com>,
	Shawn Guo <shawnguo@...nel.org>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	Pengutronix Kernel Team <kernel@...gutronix.de>,
	Fabio Estevam <festevam@...il.com>, linux-kernel@...r.kernel.org,
	arm-scmi@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	imx@...ts.linux.dev, Peng Fan <peng.fan@....com>
Subject: Re: [PATCH 2/5] firmware: arm_scmi: imx: Add i.MX95 CPU Protocol

On Wed, Jan 22, 2025 at 03:41:41PM +0300, Dan Carpenter wrote:
> On Wed, Jan 22, 2025 at 12:22:18PM +0000, Cristian Marussi wrote:
> > > > +struct scmi_msg_imx_cpu_attributes_out {
> > > > +	__le32 attributes;
> > > > +#define	CPU_MAX_NAME	16
> > > > +	u8 name[CPU_MAX_NAME];
> > >
> > > char is always unsigned in the kernel these days but strings should
> > > still always be char.  Same thing in patch 1, there were a couple u8
> > > names.
> > >
> >
> > While it is certainly true that char is the way to go for strings and, as
> > such, it is used elsewhere to hold the resource names across all SCMI
> > protocols, in this context it is a field of structure representing
> > exactly the layout of message reply coming from the server, and defined
> > in the SCMI spec as a uint8 array, so, we have generally preferred to
> > used u8 to represent such fixed size array all across the SCMI stack
> > protocols implementation....
> >
> > .... not saying that it is necessarily completelt right, but that is the
> > reason we are guilty :D
>
> Fine.  I don't have intense emotions about this.
>
> It does slightly bother me when we assume that the SCMI server NUL
> terminates these when we do things like:
>
> 	dev_info(ph->dev, "i.MX CPU: name: %s\n", out->name);
>

I was about to reply earlier and got distracted. This makes it even better.
I agree with Cristian that we have defined it as u8 when referring to the
payload from the SCMI platform/server. But it should be used only to extract
information from the response payload and copied to OSPM's own buffer before
accessing it like the above dev_info example.

In short, I agree with you Dan that it shouldn't be used in OS like above.
I haven't looked at the implementation patches(just looked at the doc 3/5),
but if they need such logging, they need to copy it to some buffer in the
kernel.

--
Regards,
Sudeep

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ