Re: [PATCH] media: dvb_ringbuffer: Return -EFAULT if copy fails

From: Dan Carpenter
Date: Wed May 24 2023 - 03:20:51 EST

On Wed, May 24, 2023 at 01:20:27PM +0800, Su Hui wrote:
> It's confusing about the comment on function declaration.
>     /**
>      * dvb_ringbuffer_write_user - Writes a buffer received via a user
> pointer
>     ..........
>      * Return: number of bytes transferred or -EFAULT
> But the function Only returns  the number of bytes transferred.
> Maybe the comment should be modified because it never returns -EFAULT.

To be honest, I think that -EFAULT is probably a better return. But
there is no way we could apply the patch with that commit message. The
commit message doesn't explain the problem for the user or why returning
the number of bytes copied is not correct in this case.

I think that maybe it's not too late to change this to return -EFAULT,
but it would have been easier to make the change in 2014 before there
were many users. Also it would be easier if you were testing this on
real hardware.

Possibly other people think the current behavior is correct or that it
is too late to change it. That's also fine. I'm not a domain expert

dan carpenter