[PATCH 2/2] ASoC: SOF: sof-client-probes: cleanup tokenize_input()

Dan Carpenter dan.carpenter at oracle.com
Wed Jul 6 12:44:43 CEST 2022


On Wed, Jul 06, 2022 at 12:27:49PM +0300, Péter Ujfalusi wrote:
> 
> 
> On 06/07/2022 10:25, Dan Carpenter wrote:
> > The tokenize_input() function is cleaner if it uses strndup_user()
> > instead of simple_write_to_buffer().  The way it's written now, if
> > *ppos is non-zero then it returns -EIO but normally we would return
> > 0 in that case.  It's easier to handle that in the callers.
> 
> This patch breaks the probe point settings:
> 
> # echo 52,1,0 > /sys/kernel/debug/sof/probe_points
> -bash: echo: write error: Invalid argument
> 
> I did not looked for the exact reason, but something is not correct.
> 

Crud...

Thanks for testing.

I used strndup_user() in a couple other patches today and I didn't
realize how strict it was.  I've NAKed my patches which used
strndup_user().  One of the patches was an infoleak patch so I'm going
to resend that using memdup_user() instead but let's just drop this one.

I guess another safer option would be to just always zero the buffers
going into simple_write_to_buffer()...

regards,
dan carpenter



More information about the Alsa-devel mailing list