[RFC PATCH 5/7] firmware: arm_scmi: Add System Telemetry chardev/ioctls API

Cristian Marussi cristian.marussi at arm.com
Wed Jun 25 07:14:47 PDT 2025


On Sat, Jun 21, 2025 at 12:51:12AM +0300, Dan Carpenter wrote:
> On Fri, Jun 20, 2025 at 08:28:11PM +0100, Cristian Marussi wrote:
> > +static long scmi_tlm_des_read_ioctl(struct scmi_tlm_instance *ti,
> > +				    unsigned long arg, bool single)
> > +{
> > +	void * __user uptr = (void * __user)arg;
> > +	struct scmi_tlm_setup *tsp = ti->tsp;
> > +	struct scmi_tlm_bulk_read bulk, *bulk_ptr;
> > +	int ret;
> > +
> > +	if (copy_from_user(&bulk, uptr, sizeof(bulk)))
> > +		return -EFAULT;
> > +
> > +	bulk_ptr = kzalloc(sizeof(*bulk_ptr) +
> > +			     bulk.num_samples * sizeof(bulk_ptr->samples[0]),
> 
> This should be struct_size(bulk_ptr, samples, bulk.num_samples) to
> avoid an integer overflow on 32bit systems.
> 
I will fix.

Thanks,
Cristian



More information about the linux-arm-kernel mailing list